Esempio n. 1
0
  public Panel(Controller baseController) {
    this.baseController = baseController;
    baseLayout = new SpringLayout();
    rockButton = new JButton("Rock");
    selection = "";
    user2Selection = "";
    userPoints = 0;
    botPoints = 0;
    paperButton = new JButton("Paper");
    scissorsButton = new JButton("Scissors");
    shootButton = new JButton("Shoot");
    selectionLabel = new JLabel("You selected: ");
    userPointsLabel = new JLabel("Your points: " + userPoints);
    botPointsLabel = new JLabel("Bot points: " + botPoints);
    dogeFaceLabel = new JLabel(new ImageIcon(getClass().getResource("images/doge.png")));
    multiplayerToggle = new JCheckBox("Multiplayer");
    rockButton2 = new JButton("Rock");
    paperButton2 = new JButton("Paper");
    scissorsButton2 = new JButton("Scissors");
    hideSelectionButton = new JButton("Hide selection");
    titleLabel = new JLabel("Rock Paper Scissors!");
    baseLayout.putConstraint(SpringLayout.WEST, titleLabel, 135, SpringLayout.WEST, this);
    baseLayout.putConstraint(
        SpringLayout.SOUTH, titleLabel, -37, SpringLayout.NORTH, selectionLabel);

    setupPanel();
    setupLayout();
    setupListeners();
  }
  private JPanel createContentPanel() {
    // compute content and other buttons
    SpringLayout springLayout = new SpringLayout();
    JPanel panel = new JPanel(springLayout);
    int panelHeight = 0;
    JTable propertiesPanel = createPropertiesPanel();
    panelHeight += propertiesPanel.getPreferredSize().getHeight();
    panel.add(propertiesPanel);
    panelHeight += 10;
    panel.add(Box.createVerticalStrut(10));
    JScrollPane scrollPane = new JScrollPane(createAdaptersPanel());
    panelHeight += scrollPane.getPreferredSize().getHeight();
    panel.add(scrollPane);
    panelHeight += 10;
    panel.add(Box.createVerticalStrut(10));
    JPanel buttonsPanel = createButtonsPanel();
    panelHeight += buttonsPanel.getPreferredSize().getHeight();
    panel.add(buttonsPanel);

    springLayout.putConstraint(
        SpringLayout.NORTH, panel, DEFAULT_PADDING, SpringLayout.NORTH, propertiesPanel);
    springLayout.putConstraint(
        SpringLayout.WEST, panel, DEFAULT_PADDING, SpringLayout.WEST, propertiesPanel);
    springLayout.putConstraint(
        SpringLayout.EAST, panel, DEFAULT_PADDING, SpringLayout.EAST, propertiesPanel);
    springLayout.putConstraint(
        SpringLayout.NORTH, scrollPane, DEFAULT_PADDING, SpringLayout.SOUTH, propertiesPanel);
    springLayout.putConstraint(
        SpringLayout.WEST, panel, DEFAULT_PADDING, SpringLayout.WEST, scrollPane);
    springLayout.putConstraint(
        SpringLayout.EAST, panel, DEFAULT_PADDING, SpringLayout.EAST, scrollPane);
    springLayout.putConstraint(
        SpringLayout.NORTH, scrollPane, DEFAULT_PADDING, SpringLayout.SOUTH, buttonsPanel);
    springLayout.putConstraint(
        SpringLayout.WEST, panel, DEFAULT_PADDING, SpringLayout.WEST, buttonsPanel);
    springLayout.putConstraint(
        SpringLayout.EAST, panel, DEFAULT_PADDING, SpringLayout.EAST, buttonsPanel);

    panel.setPreferredSize(
        new Dimension(
            CHECK_COLUMN_WIDTH + LABEL_COLUMN_WIDTH + COLUMN_WIDTH - 32,
            panelHeight + DEFAULT_PADDING));
    makeCompactGrid(panel, 5, 1, 0, 0, 0, 0);
    return panel;
  }
Esempio n. 3
0
  public TitlePanel(String panelID) {
    this.setBackground(Color.white);

    gradiantColor = new Color(100, 100, 200, 50);
    gradiantOffsetRatio = 0.5f;

    title.setFont(new java.awt.Font("MS Sans Serif", Font.BOLD, 12));
    title.setText(TInfoText.runtime.getTitle(panelID, "title"));

    infoText.setFont(new java.awt.Font("MS Sans Serif", Font.PLAIN, 11));
    infoText.setTextID(panelID, "summary");
    infoText.setBackground(Color.white);
    infoText.setOpaque(true);

    SpringLayout layout = new SpringLayout();
    setLayout(layout);

    add(title);
    add(infoText);

    // title
    layout.putConstraint(SpringLayout.WEST, title, 5, SpringLayout.WEST, this);
    layout.putConstraint(SpringLayout.NORTH, title, 5, SpringLayout.NORTH, this);

    // Beschreibung
    layout.putConstraint(SpringLayout.WEST, infoText, 10, SpringLayout.WEST, title);
    layout.putConstraint(SpringLayout.NORTH, infoText, 15, SpringLayout.NORTH, title);

    // panel edges ------------------------------------------------------
    layout.putConstraint(SpringLayout.EAST, this, 20, SpringLayout.EAST, infoText);
    layout.putConstraint(SpringLayout.SOUTH, this, 5, SpringLayout.SOUTH, infoText);

    //    this.setPreferredSize( new Dimension(200, 100) );

  }
Esempio n. 4
0
  // --------------------------------initGUI------------------------------------
  public void initGUI() {
    bDeployed = bOpponentDeployed = false;
    listAT = new LinkedList();

    frame.setJMenuBar(new GameMenuBar(this));
    panParty = new PartyPanel(200, 480);
    panStatus = new JPanel(null);
    oMap = new Map(600, 350);
    panChat = new ChatPanel(600, 200);

    Container contentPane = frame.getContentPane();

    panParty.setOpaque(true);
    panStatus.setOpaque(true);
    panChat.setOpaque(true);

    panStatus.setPreferredSize(new Dimension(200, 70));

    contentPane.add(panStatus);
    contentPane.add(panParty);
    contentPane.add(oMap);
    contentPane.add(panChat);

    SpringLayout oLayout = new SpringLayout();
    contentPane.setLayout(oLayout);

    oLayout.putConstraint(SpringLayout.WEST, panParty, 0, SpringLayout.WEST, contentPane);
    oLayout.putConstraint(SpringLayout.NORTH, panParty, 0, SpringLayout.NORTH, contentPane);
    oLayout.putConstraint(SpringLayout.WEST, panStatus, 0, SpringLayout.WEST, contentPane);
    oLayout.putConstraint(SpringLayout.SOUTH, panStatus, 0, SpringLayout.SOUTH, contentPane);
    oLayout.putConstraint(SpringLayout.EAST, oMap, 0, SpringLayout.EAST, contentPane);
    oLayout.putConstraint(SpringLayout.NORTH, oMap, 0, SpringLayout.NORTH, contentPane);
    oLayout.putConstraint(SpringLayout.WEST, panChat, 0, SpringLayout.EAST, panStatus);
    oLayout.putConstraint(SpringLayout.NORTH, panChat, 0, SpringLayout.SOUTH, oMap);
    oLayout.putConstraint(SpringLayout.EAST, contentPane, 0, SpringLayout.EAST, panChat);
    oLayout.putConstraint(SpringLayout.SOUTH, contentPane, 0, SpringLayout.SOUTH, panChat);

    panChat.validate();
    panChat.setVisible(true);

    Insets oInsets = panStatus.getInsets();
    int nX = oInsets.left + 5;
    int nY = oInsets.top + 5;

    lblStatus1 = new JLabel("Not Connected...");
    lblStatus2 = new JLabel("No Party Formed...");
    lblStatus3 = new JLabel();

    Dimension oSize = lblStatus1.getPreferredSize();

    lblStatus1.setBounds(nX, nY, 180, oSize.height);
    nY += oSize.height + 7;
    lblStatus2.setBounds(nX, nY, 180, oSize.height);
    nY += oSize.height + 7;
    lblStatus3.setBounds(nX, nY, 180, oSize.height);

    panStatus.add(lblStatus1);
    panStatus.add(lblStatus2);
    panStatus.add(lblStatus3);

    frame.pack();
    frame.setResizable(false);
    frame.setLocation(
        ((scrBounds.x + scrBounds.width - frame.getWidth()) / 2),
        ((scrBounds.y + scrBounds.height - frame.getHeight()) / 2));

    oMap.addKeyListener(oMap);
    oMap.setButtonEvents(this);
  }
    private void initComponents() {

      setPreferredSize(new java.awt.Dimension(420, 65));

      this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

      JPanel buttonPanel = new JPanel();
      buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
      JPanel textPanel = new JPanel();
      SpringLayout textLayout = new SpringLayout();
      textPanel.setLayout(textLayout);
      this.add(buttonPanel);
      this.add(textPanel);

      // button area
      abortButton_ = new JButton();
      abortButton_.setBackground(new java.awt.Color(255, 255, 255));
      abortButton_.setIcon(
          new javax.swing.ImageIcon(
              getClass().getResource("/org/micromanager/icons/cancel.png"))); // NOI18N
      abortButton_.setToolTipText("Abort acquisition");
      abortButton_.setFocusable(false);
      abortButton_.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
      abortButton_.setMaximumSize(new java.awt.Dimension(30, 28));
      abortButton_.setMinimumSize(new java.awt.Dimension(30, 28));
      abortButton_.setPreferredSize(new java.awt.Dimension(30, 28));
      abortButton_.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
      abortButton_.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              try {
                JavaUtils.invokeRestrictedMethod(vad_, VirtualAcquisitionDisplay.class, "abort");
              } catch (Exception ex) {
                ReportingUtils.showError(
                    "Couldn't abort. Try pressing stop on Multi-Dimensional acquisition Window");
              }
            }
          });
      buttonPanel.add(abortButton_);

      pauseButton_ = new JButton();
      pauseButton_.setIcon(
          new javax.swing.ImageIcon(
              getClass().getResource("/org/micromanager/icons/control_pause.png"))); // NOI18N
      pauseButton_.setToolTipText("Pause acquisition");
      pauseButton_.setFocusable(false);
      pauseButton_.setMargin(new java.awt.Insets(0, 0, 0, 0));
      pauseButton_.setMaximumSize(new java.awt.Dimension(30, 28));
      pauseButton_.setMinimumSize(new java.awt.Dimension(30, 28));
      pauseButton_.setPreferredSize(new java.awt.Dimension(30, 28));
      pauseButton_.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              try {
                JavaUtils.invokeRestrictedMethod(vad_, VirtualAcquisitionDisplay.class, "pause");
              } catch (Exception ex) {
                ReportingUtils.showError("Couldn't pause");
              }
              if (eng_.isPaused()) {
                pauseButton_.setIcon(
                    new javax.swing.ImageIcon(
                        getClass()
                            .getResource("/org/micromanager/icons/resultset_next.png"))); // NOI18N
              } else {
                pauseButton_.setIcon(
                    new javax.swing.ImageIcon(
                        getClass()
                            .getResource("/org/micromanager/icons/control_pause.png"))); // NOI18N
              }
            }
          });
      buttonPanel.add(pauseButton_);

      gridXSpinner_ = new JSpinner();
      gridXSpinner_.setModel(new SpinnerNumberModel(2, 1, 1000, 1));
      gridXSpinner_.setPreferredSize(new Dimension(35, 24));
      gridYSpinner_ = new JSpinner();
      gridYSpinner_.setModel(new SpinnerNumberModel(2, 1, 1000, 1));
      gridYSpinner_.setPreferredSize(new Dimension(35, 24));
      gridXSpinner_.addChangeListener(
          new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
              gridSizeChanged();
            }
          });
      gridYSpinner_.addChangeListener(
          new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
              gridSizeChanged();
            }
          });
      final JLabel gridLabel = new JLabel(" grid");
      final JLabel byLabel = new JLabel("by");
      gridLabel.setEnabled(false);
      byLabel.setEnabled(false);
      gridXSpinner_.setEnabled(false);
      gridYSpinner_.setEnabled(false);

      final JButton createGridButton = new JButton("Create");
      createGridButton.setEnabled(false);
      createGridButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              createGrid();
            }
          });

      newGridButton_ = new JToggleButton("New grid");
      buttonPanel.add(new JLabel("    "));
      buttonPanel.add(newGridButton_);
      newGridButton_.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              if (newGridButton_.isSelected()) {
                makeGridOverlay(
                    vad_.getImagePlus().getWidth() / 2, vad_.getImagePlus().getHeight() / 2);
                newGridButton_.setText("Cancel");
                gridLabel.setEnabled(true);
                byLabel.setEnabled(true);
                gridXSpinner_.setEnabled(true);
                gridYSpinner_.setEnabled(true);
                createGridButton.setEnabled(true);
              } else {
                vad_.getImagePlus().getOverlay().clear();
                vad_.getImagePlus().getCanvas().repaint();
                newGridButton_.setText("New grid");
                gridLabel.setEnabled(false);
                byLabel.setEnabled(false);
                gridXSpinner_.setEnabled(false);
                gridYSpinner_.setEnabled(false);
                createGridButton.setEnabled(false);
              }
            }
          });

      buttonPanel.add(gridXSpinner_);
      buttonPanel.add(byLabel);
      buttonPanel.add(gridYSpinner_);
      buttonPanel.add(gridLabel);
      buttonPanel.add(createGridButton);

      // text area
      zPosLabel_ = new JLabel("Z position:                    ");
      textPanel.add(zPosLabel_);

      timeStampLabel_ = new JLabel("Elapsed time:                               ");
      textPanel.add(timeStampLabel_);

      fpsField_ = new JTextField();
      fpsField_.setText("7");
      fpsField_.setToolTipText("Set the speed at which the acquisition is played back.");
      fpsField_.setPreferredSize(new Dimension(25, 18));
      fpsField_.addFocusListener(
          new java.awt.event.FocusAdapter() {

            public void focusLost(java.awt.event.FocusEvent evt) {
              updateFPS();
            }
          });
      fpsField_.addKeyListener(
          new java.awt.event.KeyAdapter() {

            public void keyReleased(java.awt.event.KeyEvent evt) {
              updateFPS();
            }
          });
      JLabel fpsLabel = new JLabel("Animation playback FPS: ");
      textPanel.add(fpsLabel);
      textPanel.add(fpsField_);

      textLayout.putConstraint(SpringLayout.WEST, textPanel, 0, SpringLayout.WEST, zPosLabel_);
      textLayout.putConstraint(
          SpringLayout.EAST, zPosLabel_, 0, SpringLayout.WEST, timeStampLabel_);
      textLayout.putConstraint(SpringLayout.EAST, timeStampLabel_, 0, SpringLayout.WEST, fpsLabel);
      textLayout.putConstraint(SpringLayout.EAST, fpsLabel, 0, SpringLayout.WEST, fpsField_);
      textLayout.putConstraint(SpringLayout.EAST, fpsField_, 0, SpringLayout.EAST, textPanel);

      textLayout.putConstraint(SpringLayout.NORTH, fpsField_, 0, SpringLayout.NORTH, textPanel);
      textLayout.putConstraint(SpringLayout.NORTH, zPosLabel_, 3, SpringLayout.NORTH, textPanel);
      textLayout.putConstraint(
          SpringLayout.NORTH, timeStampLabel_, 3, SpringLayout.NORTH, textPanel);
      textLayout.putConstraint(SpringLayout.NORTH, fpsLabel, 3, SpringLayout.NORTH, textPanel);
    }
Esempio n. 6
0
  public MasterConfigPanel() {
    this.setLayout(layout);
    Border blackline = BorderFactory.createLineBorder(Color.BLACK);

    for (int i = 0; i < textfield.length; i++) {
      label[i] = new JLabel(labels[i]);
      textfield[i] = new JTextField(20);
      this.add(label[i]);
      this.add(textfield[i]);
      textfield[i].addFocusListener(this);
    }

    label[5] = new JLabel(labels[5]);
    this.add(label[5]);

    combo = new JComboBox(trust);
    combo.setSelectedIndex(0);
    combo.addActionListener(this);
    this.add(combo);

    textfield[0].setText("<For Example: 10>");
    textfield[1].setText("<For Example: AM10>");
    textfield[2].setText("<For Example: modelbase.PurchaseLogicCollusion>");
    textfield[3].setText("<For Example: modelbase.RatingLogicCollusion>");
    textfield[4].setText("<For Example: 0,4,5,7,9>");

    next_config = new JButton("Config");
    this.add(next_config);

    brsConfig = new BRSConfigPanel();
    TitledBorder brsTitle =
        BorderFactory.createTitledBorder(blackline, "BRS Trust Model Configuration");
    brsConfig.setBorder(brsTitle);

    travosConfig = new TRAVOSConfigPanel();
    TitledBorder travosTitle =
        BorderFactory.createTitledBorder(blackline, "TRAVOS Trust Model Configuration");
    travosConfig.setBorder(travosTitle);

    personalizedConfig = new PersonalizedConfigPanel();
    TitledBorder personalizedTitle =
        BorderFactory.createTitledBorder(blackline, "Personalized Trust Model Configuration");
    personalizedConfig.setBorder(personalizedTitle);

    othersConfig = new OthersConfigPanel();
    TitledBorder othersTitle =
        BorderFactory.createTitledBorder(blackline, "Others Trust Model Configuration");
    othersConfig.setBorder(othersTitle);

    this.add(brsConfig);
    this.add(travosConfig);
    this.add(personalizedConfig);
    this.add(othersConfig);

    layout.putConstraint(SpringLayout.WEST, label[0], 5, SpringLayout.WEST, this);
    layout.putConstraint(SpringLayout.NORTH, label[0], 5, SpringLayout.NORTH, this);

    layout.putConstraint(SpringLayout.WEST, textfield[0], 95, SpringLayout.EAST, label[0]);
    layout.putConstraint(SpringLayout.NORTH, textfield[0], 5, SpringLayout.NORTH, this);

    for (int i = 1; i < textfield.length; i++) {
      layout.putConstraint(SpringLayout.WEST, label[i], 5, SpringLayout.WEST, this);
      layout.putConstraint(SpringLayout.NORTH, label[i], 5, SpringLayout.SOUTH, textfield[i - 1]);

      layout.putConstraint(SpringLayout.WEST, textfield[i], 0, SpringLayout.WEST, textfield[i - 1]);
      layout.putConstraint(
          SpringLayout.NORTH, textfield[i], 5, SpringLayout.SOUTH, textfield[i - 1]);
      layout.putConstraint(SpringLayout.EAST, textfield[i], 0, SpringLayout.EAST, textfield[0]);
    }

    layout.putConstraint(SpringLayout.WEST, label[5], 5, SpringLayout.WEST, this);
    layout.putConstraint(SpringLayout.NORTH, label[5], 5, SpringLayout.SOUTH, textfield[4]);

    layout.putConstraint(SpringLayout.WEST, combo, 0, SpringLayout.WEST, textfield[4]);
    layout.putConstraint(SpringLayout.NORTH, combo, 5, SpringLayout.SOUTH, textfield[4]);
    layout.putConstraint(SpringLayout.EAST, combo, 0, SpringLayout.EAST, textfield[0]);

    layout.putConstraint(SpringLayout.WEST, brsConfig, 5, SpringLayout.WEST, this);
    layout.putConstraint(SpringLayout.NORTH, brsConfig, 5, SpringLayout.SOUTH, combo);
    layout.putConstraint(SpringLayout.EAST, brsConfig, 5, SpringLayout.EAST, combo);

    layout.putConstraint(SpringLayout.WEST, travosConfig, 5, SpringLayout.WEST, this);
    layout.putConstraint(SpringLayout.NORTH, travosConfig, 5, SpringLayout.SOUTH, combo);
    layout.putConstraint(SpringLayout.EAST, travosConfig, 5, SpringLayout.EAST, combo);

    layout.putConstraint(SpringLayout.WEST, personalizedConfig, 5, SpringLayout.WEST, this);
    layout.putConstraint(SpringLayout.NORTH, personalizedConfig, 5, SpringLayout.SOUTH, combo);
    layout.putConstraint(SpringLayout.EAST, personalizedConfig, 5, SpringLayout.EAST, combo);

    layout.putConstraint(SpringLayout.WEST, othersConfig, 5, SpringLayout.WEST, this);
    layout.putConstraint(SpringLayout.NORTH, othersConfig, 5, SpringLayout.SOUTH, combo);
    layout.putConstraint(SpringLayout.EAST, othersConfig, 5, SpringLayout.EAST, combo);

    layout.putConstraint(SpringLayout.WEST, next_config, 0, SpringLayout.WEST, textfield[0]);
    layout.putConstraint(
        SpringLayout.NORTH, next_config, 5, SpringLayout.SOUTH, personalizedConfig);
    layout.putConstraint(SpringLayout.SOUTH, this, 5, SpringLayout.SOUTH, next_config);

    this.setVisible(false);
  }
Esempio n. 7
0
  public Marketplace_Master() {
    this.setLayout(layout);

    for (int i = 0; i < textfield.length; i++) {
      label[i] = new JLabel(labels[i]);
      textfield[i] = new JTextField(20);
      this.add(label[i]);
      this.add(textfield[i]);
      textfield[i].addFocusListener(this);
    }

    label[5] = new JLabel(labels[5]);
    this.add(label[5]);

    combo = new JComboBox(trust);
    combo.setSelectedIndex(0);
    this.add(combo);

    this.setTextField();

    layout.putConstraint(SpringLayout.WEST, label[0], 10, SpringLayout.WEST, this);
    layout.putConstraint(SpringLayout.NORTH, label[0], 10, SpringLayout.NORTH, this);

    layout.putConstraint(SpringLayout.WEST, textfield[0], 101, SpringLayout.EAST, label[0]);
    layout.putConstraint(SpringLayout.NORTH, textfield[0], 10, SpringLayout.NORTH, this);
    layout.putConstraint(SpringLayout.EAST, textfield[0], -10, SpringLayout.EAST, this);

    for (int i = 1; i < textfield.length; i++) {
      layout.putConstraint(SpringLayout.WEST, label[i], 10, SpringLayout.WEST, this);
      layout.putConstraint(SpringLayout.NORTH, label[i], 10, SpringLayout.SOUTH, textfield[i - 1]);

      layout.putConstraint(SpringLayout.WEST, textfield[i], 0, SpringLayout.WEST, textfield[i - 1]);
      layout.putConstraint(
          SpringLayout.NORTH, textfield[i], 10, SpringLayout.SOUTH, textfield[i - 1]);
      layout.putConstraint(SpringLayout.EAST, textfield[i], 0, SpringLayout.EAST, textfield[0]);
    }

    layout.putConstraint(SpringLayout.WEST, label[5], 5, SpringLayout.WEST, this);
    layout.putConstraint(SpringLayout.NORTH, label[5], 5, SpringLayout.SOUTH, textfield[4]);

    layout.putConstraint(SpringLayout.WEST, combo, 0, SpringLayout.WEST, textfield[4]);
    layout.putConstraint(SpringLayout.NORTH, combo, 5, SpringLayout.SOUTH, textfield[4]);
    layout.putConstraint(SpringLayout.EAST, combo, 0, SpringLayout.EAST, textfield[0]);
    layout.putConstraint(SpringLayout.SOUTH, this, 10, SpringLayout.SOUTH, combo);

    this.setVisible(false);
  }
Esempio n. 8
0
 private void setupLayout() {
   baseLayout.putConstraint(SpringLayout.NORTH, selectionLabel, 103, SpringLayout.NORTH, this);
   baseLayout.putConstraint(SpringLayout.WEST, selectionLabel, 166, SpringLayout.WEST, this);
   baseLayout.putConstraint(SpringLayout.EAST, botPointsLabel, -10, SpringLayout.EAST, this);
   baseLayout.putConstraint(SpringLayout.NORTH, paperButton, 6, SpringLayout.SOUTH, rockButton);
   baseLayout.putConstraint(SpringLayout.WEST, paperButton, 0, SpringLayout.WEST, rockButton);
   baseLayout.putConstraint(SpringLayout.SOUTH, rockButton, -244, SpringLayout.SOUTH, this);
   baseLayout.putConstraint(
       SpringLayout.NORTH, scissorsButton, 6, SpringLayout.SOUTH, paperButton);
   baseLayout.putConstraint(SpringLayout.WEST, scissorsButton, 0, SpringLayout.WEST, rockButton);
   baseLayout.putConstraint(SpringLayout.WEST, rockButton, 10, SpringLayout.WEST, this);
   baseLayout.putConstraint(SpringLayout.WEST, shootButton, 0, SpringLayout.WEST, selectionLabel);
   baseLayout.putConstraint(SpringLayout.NORTH, shootButton, 0, SpringLayout.NORTH, paperButton);
   baseLayout.putConstraint(
       SpringLayout.WEST, multiplayerToggle, 0, SpringLayout.WEST, rockButton);
   baseLayout.putConstraint(
       SpringLayout.NORTH, userPointsLabel, 0, SpringLayout.NORTH, botPointsLabel);
   baseLayout.putConstraint(SpringLayout.NORTH, botPointsLabel, 10, SpringLayout.NORTH, this);
   baseLayout.putConstraint(SpringLayout.WEST, userPointsLabel, 0, SpringLayout.WEST, rockButton);
   baseLayout.putConstraint(
       SpringLayout.NORTH, scissorsButton2, 0, SpringLayout.NORTH, scissorsButton);
   baseLayout.putConstraint(
       SpringLayout.EAST, scissorsButton2, 0, SpringLayout.EAST, botPointsLabel);
   baseLayout.putConstraint(SpringLayout.NORTH, paperButton2, 0, SpringLayout.NORTH, paperButton);
   baseLayout.putConstraint(SpringLayout.EAST, paperButton2, 0, SpringLayout.EAST, botPointsLabel);
   baseLayout.putConstraint(SpringLayout.NORTH, rockButton2, 0, SpringLayout.NORTH, rockButton);
   baseLayout.putConstraint(SpringLayout.EAST, rockButton2, 0, SpringLayout.EAST, botPointsLabel);
   baseLayout.putConstraint(SpringLayout.SOUTH, multiplayerToggle, -10, SpringLayout.SOUTH, this);
   baseLayout.putConstraint(SpringLayout.SOUTH, hideSelectionButton, 0, SpringLayout.SOUTH, this);
   baseLayout.putConstraint(SpringLayout.EAST, hideSelectionButton, 0, SpringLayout.EAST, this);
   baseLayout.putConstraint(
       SpringLayout.EAST, dogeFaceLabel, -6, SpringLayout.WEST, scissorsButton2);
   baseLayout.putConstraint(
       SpringLayout.NORTH, dogeFaceLabel, 0, SpringLayout.NORTH, scissorsButton);
 }
  private void makeGUI() {
    // Set Frames properties
    this.setTitle("Search And Edit Student");
    this.setSize(700, 500);
    this.setLocationRelativeTo(null);
    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    // Add components to panel_1
    FlowLayout layout = new FlowLayout();
    layout.setAlignment(FlowLayout.LEFT);
    panel_1.setLayout(layout);
    panel_1.add(searchcombobox);
    panel_1.add(searchtextfield);
    panel_1.add(searchbutton);
    panel_1.add(allfieldcheckbox);
    panel_1.setBackground(Color.WHITE);

    // Add panel_1 to frame
    this.add(panel_1, BorderLayout.PAGE_START);

    // Add components to panel_2
    panel_2.add(totalstudentlabel);
    panel_2.setBackground(Color.WHITE);

    // Add panel_2 to frame
    this.add(panel_2, BorderLayout.PAGE_END);

    // Add components to panel_3
    panel_3.setLayout(new GridLayout(1, 0));

    // Design panel_5
    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    c.weightx = 1;
    c.weighty = 1;
    c.fill = GridBagConstraints.BOTH;

    panel_5.setLayout(gbl);

    c.gridx = 0;
    c.gridy = 0;
    c.gridheight = 4;
    c.gridwidth = GridBagConstraints.REMAINDER;
    panel_5.add(panel_3, c);

    c.gridx = 0;
    c.gridy = 5;
    c.gridheight = 2;
    c.gridwidth = GridBagConstraints.REMAINDER;
    panel_5.add(panel_4, c);

    // Add components to panel_4
    panel_4.setLayout(new GridLayout(1, 2));
    panel_4.add(panel_6); // Lower Left
    panel_4.add(panel_7); // Lower Right

    // Design panel 6
    SpringLayout sl = new SpringLayout();
    panel_6.setLayout(sl);

    sl.putConstraint(SpringLayout.WEST, feespayedlabel, 2, SpringLayout.WEST, panel_6);
    sl.putConstraint(SpringLayout.NORTH, feespayedlabel, 2, SpringLayout.NORTH, panel_6);

    sl.putConstraint(SpringLayout.WEST, addfeestextfield, 2, SpringLayout.EAST, feespayedlabel);
    sl.putConstraint(SpringLayout.NORTH, addfeestextfield, 2, SpringLayout.NORTH, panel_6);

    sl.putConstraint(SpringLayout.WEST, addfeesbutton, 2, SpringLayout.EAST, addfeestextfield);
    sl.putConstraint(SpringLayout.NORTH, addfeesbutton, 2, SpringLayout.NORTH, panel_6);

    sl.putConstraint(SpringLayout.WEST, feesduelabel, 2, SpringLayout.WEST, panel_6);
    sl.putConstraint(SpringLayout.NORTH, feesduelabel, 2, SpringLayout.SOUTH, addfeesbutton);

    sl.putConstraint(SpringLayout.WEST, totalfeeslabel, 2, SpringLayout.WEST, panel_6);
    sl.putConstraint(SpringLayout.NORTH, totalfeeslabel, 2, SpringLayout.SOUTH, feesduelabel);

    sl.putConstraint(SpringLayout.WEST, coursecombobox, 2, SpringLayout.WEST, panel_6);
    sl.putConstraint(SpringLayout.NORTH, coursecombobox, 3, SpringLayout.SOUTH, totalfeeslabel);

    sl.putConstraint(SpringLayout.WEST, spinner, 2, SpringLayout.EAST, coursecombobox);
    sl.putConstraint(SpringLayout.NORTH, spinner, 3, SpringLayout.SOUTH, totalfeeslabel);

    sl.putConstraint(SpringLayout.WEST, addcoursebutton, 2, SpringLayout.WEST, panel_6);
    sl.putConstraint(SpringLayout.NORTH, addcoursebutton, 3, SpringLayout.SOUTH, coursecombobox);

    panel_6.add(feespayedlabel);
    panel_6.add(addfeestextfield);
    panel_6.add(addfeesbutton);
    panel_6.add(feesduelabel);
    panel_6.add(totalfeeslabel);
    panel_6.add(coursecombobox);
    panel_6.add(spinner);
    panel_6.add(addcoursebutton);

    // Set panel 7 layout
    panel_7.setLayout(new GridLayout(1, 0));
    panel_7.setBackground(Color.WHITE);

    // Add panel_5 to frame
    this.add(panel_5);

    update();

    // Show frame
    this.validate();
    this.setVisible(true);
  }
Esempio n. 10
0
  private void initComponents() {
    contentPane = this.getContentPane();
    SpringLayout layout = new SpringLayout();
    contentPane.setLayout(layout);

    useImageButton = new JButton("Use Image");
    clearLayoutButton = new JButton("Clear Layout");
    loadLayoutButton = new JButton("Load Layout");
    saveLayoutButton = new JButton("Save Layout");
    dumpImagesButton = new JButton("Dump Box Images");
    nameTextField = new JTextField(10);
    nameTextField.setEnabled(false);
    descTextField = new JTextField(10);
    descTextField.setEnabled(false);

    contentPane.add(useImageButton);
    layout.putConstraint(SpringLayout.WEST, useImageButton, 10, SpringLayout.WEST, contentPane);
    layout.putConstraint(
        SpringLayout.NORTH, useImageButton, 10 + 30 * 0, SpringLayout.NORTH, contentPane);

    contentPane.add(clearLayoutButton);
    layout.putConstraint(SpringLayout.WEST, clearLayoutButton, 10, SpringLayout.WEST, contentPane);
    layout.putConstraint(
        SpringLayout.NORTH, clearLayoutButton, 10 + 30 * 1, SpringLayout.NORTH, contentPane);

    contentPane.add(loadLayoutButton);
    layout.putConstraint(SpringLayout.WEST, loadLayoutButton, 10, SpringLayout.WEST, contentPane);
    layout.putConstraint(
        SpringLayout.NORTH, loadLayoutButton, 10 + 30 * 2, SpringLayout.NORTH, contentPane);

    contentPane.add(saveLayoutButton);
    layout.putConstraint(SpringLayout.WEST, saveLayoutButton, 10, SpringLayout.WEST, contentPane);
    layout.putConstraint(
        SpringLayout.NORTH, saveLayoutButton, 10 + 30 * 3, SpringLayout.NORTH, contentPane);

    contentPane.add(dumpImagesButton);
    layout.putConstraint(SpringLayout.WEST, dumpImagesButton, 10, SpringLayout.WEST, contentPane);
    layout.putConstraint(
        SpringLayout.NORTH, dumpImagesButton, 10 + 30 * 4, SpringLayout.NORTH, contentPane);

    contentPane.add(nameTextField);
    layout.putConstraint(SpringLayout.WEST, nameTextField, 10, SpringLayout.WEST, contentPane);
    layout.putConstraint(
        SpringLayout.NORTH, nameTextField, 10 + 30 * 5, SpringLayout.NORTH, contentPane);

    contentPane.add(descTextField);
    layout.putConstraint(SpringLayout.WEST, descTextField, 10, SpringLayout.WEST, contentPane);
    layout.putConstraint(
        SpringLayout.NORTH, descTextField, 10 + 30 * 6, SpringLayout.NORTH, contentPane);
  }
Esempio n. 11
0
  private JPanel getContentPanel(WizardData wzd) {

    JPanel contentPanel1 = new JPanel();

    welcomeTitle = new JLabel();

    contentPanel1.setLayout(new java.awt.BorderLayout());

    welcomeTitle.setFont(new java.awt.Font("MS Sans Serif", Font.BOLD, 11));
    welcomeTitle.setText("Please insert already existing language files!");
    contentPanel1.add(welcomeTitle, BorderLayout.NORTH);

    // ------------------------------------------------------------------------
    Container mainPanel = new JPanel();
    SpringLayout layout = new SpringLayout();
    mainPanel.setLayout(layout);

    JTextArea infoText = new JTextArea();
    infoText.setLineWrap(false);
    infoText.setEditable(false);
    infoText.setFocusable(false);
    infoText.setBackground(mainPanel.getBackground());
    infoText.append(TInfoText.runtime.getText("newwizard", "site2"));

    JDialog parent = null;
    if (wzd.getWizard() != null) {
      parent = wzd.getWizard().getDialog();
    }
    table = new LanguageManagerPanel(TGlobal.projects.getCurrentProject(), parent, true);

    rescanButton.addActionListener(this);
    baseButton.addActionListener(this);

    // Create and add the components.
    mainPanel.add(infoText);
    mainPanel.add(baseLabel);
    mainPanel.add(baseField);
    mainPanel.add(baseButton);
    mainPanel.add(rescanButton);
    mainPanel.add(table);

    // infoText
    layout.putConstraint(SpringLayout.WEST, infoText, 5, SpringLayout.WEST, mainPanel);
    layout.putConstraint(SpringLayout.NORTH, infoText, 5, SpringLayout.NORTH, mainPanel);

    // baseLabel -------------------------------------------------------------
    layout.putConstraint(SpringLayout.WEST, baseLabel, 0, SpringLayout.WEST, infoText);
    layout.putConstraint(SpringLayout.NORTH, baseLabel, 12, SpringLayout.SOUTH, infoText);

    // nameField
    layout.putConstraint(SpringLayout.WEST, baseField, 5, SpringLayout.EAST, baseLabel);
    layout.putConstraint(SpringLayout.NORTH, baseField, 10, SpringLayout.SOUTH, infoText);

    // baseButton
    layout.putConstraint(SpringLayout.WEST, baseButton, 5, SpringLayout.EAST, baseField);
    layout.putConstraint(SpringLayout.NORTH, baseButton, 7, SpringLayout.SOUTH, infoText);

    // rescanButton
    layout.putConstraint(SpringLayout.WEST, rescanButton, 5, SpringLayout.EAST, baseButton);
    layout.putConstraint(SpringLayout.NORTH, rescanButton, 7, SpringLayout.SOUTH, infoText);

    // table
    layout.putConstraint(SpringLayout.WEST, table, 5, SpringLayout.WEST, mainPanel);
    layout.putConstraint(SpringLayout.NORTH, table, 15, SpringLayout.SOUTH, baseField);

    // panel edges ------------------------------------------------------
    layout.putConstraint(SpringLayout.EAST, mainPanel, 5, SpringLayout.EAST, infoText);
    layout.putConstraint(SpringLayout.SOUTH, mainPanel, 5, SpringLayout.SOUTH, table);

    layout.layoutContainer(mainPanel);
    contentPanel1.add(mainPanel, BorderLayout.CENTER);

    return contentPanel1;
  }
Esempio n. 12
0
  public EditPackageDialog(JFrame frame) {
    super(frame, "Package Management- Edit a TV Package", true);

    label1 = new JLabel("Package Code: ");
    label2 = new JLabel("Package Name: ");
    error3 = new JLabel("Blank input occured! Please reenter it.");
    label3 = new JLabel("Charge Price(RM): ");
    error4 = new JLabel("Blank input occured! Please reenter it.");
    error6 = new JLabel("Wrong input format. Please enter in numeric format!");
    label4 = new JLabel("Charge Type: ");
    error5 = new JLabel("Blank input occured! Please reenter it.");
    error7 = new JLabel("You must have at least one programme added to your package.");
    label5 = new JLabel("Programmes: ");
    label6 = new JLabel("Programmes inside this Package: ");

    textfield1 = new JTextField(15);
    textfield2 = new JTextField(15);
    textfield3 = new JTextField(15);
    textfield3.setEditable(false);
    combobox1 = new JComboBox();
    button1 = new JButton("Submit");
    button2 = new JButton("Cancel");
    addBut = new JButton("", new ImageIcon(getClass().getResource("/resources/addtoright.png")));
    rmvBut = new JButton("", new ImageIcon(getClass().getResource("/resources/removetoleft.png")));
    addBut.setBackground(new Color(23, 28, 31));
    rmvBut.setBackground(new Color(23, 28, 31));

    color = new Color(23, 28, 30);
    color1 = new Color(244, 219, 234);
    color2 = new Color(239, 237, 237);
    textfield3.setBackground(color2);

    selPrgList = new LinkedList<>();
    leftModel = new DefaultListModel();
    rightModel = new DefaultListModel();
    for (int i = 0; i < App.prgList.size(); i++) {
      for (int j = 0; j < App.pckgingList.size(); j++) {
        if (PackagePanel.pkgtemp[0].equalsIgnoreCase(App.pckgingList.get(j).getPkgCode())) {
          if (App.pckgingList
              .get(j)
              .getProgCode()
              .equalsIgnoreCase(App.prgList.get(i).getProgCode())) {
            selPrgList.add(App.pckgingList.get(j).getProgCode());
            ((DefaultListModel) rightModel)
                .addElement(
                    App.pckgingList.get(j).getProgCode() + "-" + App.prgList.get(i).getProgTitle());
          }
        }
      }
    }
    selPrg = selPrgList.toArray(new String[selPrgList.size()]);

    for (int i = 0; i < App.prgList.size(); i++) {
      boolean check = false;
      for (int j = 0; j < selPrg.length; j++) {

        if (selPrg[j].equalsIgnoreCase(App.prgList.get(i).getProgCode())) {
          check = true;
          break;
        }
      }
      if (check == false) {
        if (!(App.prgList.get(i).getPrgStatus().equalsIgnoreCase("TERMINATED"))) {
          ((DefaultListModel) leftModel)
              .addElement(
                  App.prgList.get(i).getProgCode() + "-" + App.prgList.get(i).getProgTitle());
        }
      }
    }

    leftList = new JList(leftModel);
    leftList.setModel(leftModel);
    leftList.setVisibleRowCount(13);
    leftList.setFixedCellWidth(210);
    leftList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    rightList = new JList(rightModel);
    rightList.setModel(rightModel);
    rightList.setVisibleRowCount(13);
    rightList.setFixedCellWidth(210);
    rightList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    leftListScroll = new JScrollPane(leftList);
    leftListScroll.setViewportView(leftList);
    rightListScroll = new JScrollPane(rightList);
    rightListScroll.setViewportView(rightList);

    Container container = getContentPane();
    container.setBackground(color);
    SpringLayout spring = new SpringLayout();

    String[] string1 = {
      "<-----Please Choose a charge type----->", "Monthly", "Quarterly", "Annually"
    };
    combobox1.setModel(new DefaultComboBoxModel(string1));
    error3.setForeground(Color.RED);
    error4.setForeground(Color.RED);
    error5.setForeground(Color.RED);
    error6.setForeground(Color.RED);
    error7.setForeground(Color.RED);
    error3.setVisible(false);
    error4.setVisible(false);
    error5.setVisible(false);
    error6.setVisible(false);
    error7.setVisible(false);
    label1.setForeground(color1);
    label2.setForeground(color1);
    label3.setForeground(color1);
    label4.setForeground(color1);
    label5.setForeground(color1);
    label6.setForeground(color1);

    textfield3.setText(PackagePanel.pkgtemp[0]);
    textfield1.setText(PackagePanel.pkgtemp[1]);
    textfield2.setText(PackagePanel.pkgtemp[2]);
    combobox1.setSelectedItem((String) (PackagePanel.pkgtemp[3]));

    addBut.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              int leftIndex = leftList.getSelectedIndex();
              String toBeAdded = ((String) leftList.getModel().getElementAt(leftIndex));
              LinkedList<String> leftElements = new LinkedList<>();
              for (int p = 0; p < leftList.getModel().getSize(); p++) {
                leftElements.add((String) leftList.getModel().getElementAt(p));
              }

              for (int i = 0; i < leftElements.size(); i++) {
                if ((leftElements.get(i)).equals(toBeAdded)) {
                  leftElements.remove(i);
                  break;
                }
              }

              String[] leftElArr = leftElements.toArray(new String[leftElements.size()]);
              leftList.setListData(leftElArr);
              leftList.revalidate();
              leftList.repaint();

              rightElements = new LinkedList<>();
              for (int z = 0; z < rightList.getModel().getSize(); z++) {
                rightElements.add((String) rightList.getModel().getElementAt(z));
              }
              rightElements.add(toBeAdded);
              rightElArr = rightElements.toArray(new String[rightElements.size()]);
              rightList.setListData(rightElArr);
              rightList.repaint();
              rightList.revalidate();
            } catch (Exception ex) {

              JOptionPane.showMessageDialog(
                  null,
                  "You can only add a TV Programme from the left list.",
                  "Adding error",
                  JOptionPane.INFORMATION_MESSAGE);
            }
          }
        });

    rmvBut.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              int rightIndex = rightList.getSelectedIndex();
              String toBeRemoved = ((String) rightList.getModel().getElementAt(rightIndex));
              LinkedList<String> rightElements = new LinkedList<>();
              for (int p = 0; p < rightList.getModel().getSize(); p++) {
                rightElements.add((String) rightList.getModel().getElementAt(p));
              }

              for (int i = 0; i < rightElements.size(); i++) {
                if ((rightElements.get(i)).equals(toBeRemoved)) {
                  rightElements.remove(i);
                  break;
                }
              }

              rightElArr = rightElements.toArray(new String[rightElements.size()]);
              rightList.setListData(rightElArr);
              rightList.revalidate();
              rightList.repaint();

              LinkedList<String> leftElements = new LinkedList<>();
              for (int z = 0; z < leftList.getModel().getSize(); z++) {
                leftElements.add((String) leftList.getModel().getElementAt(z));
              }
              leftElements.add(toBeRemoved);
              String[] leftElArr = leftElements.toArray(new String[leftElements.size()]);
              leftList.setListData(leftElArr);
              leftList.repaint();
              leftList.revalidate();

            } catch (Exception ex) {

              JOptionPane.showMessageDialog(
                  null,
                  "You can only remove a TV Programme from the right list when right list is filled in with TV Programme.",
                  "Remove error",
                  JOptionPane.INFORMATION_MESSAGE);
            }
          }
        });

    button1.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {

            boolean flag1 = false, flag2 = false, flag3 = false, flag4 = false;

            if ((textfield1.getText().trim() == null)
                || (textfield1.getText().trim().equalsIgnoreCase(""))) {
              error3.setVisible(true);
              flag1 = false;
            } else {
              flag1 = true;
              error3.setVisible(false);
            }

            if ((textfield2.getText().trim() == null)
                || (textfield2.getText().trim().equalsIgnoreCase(""))) {
              error4.setVisible(true);
              error6.setVisible(false);
              flag2 = false;
            } else {
              try {
                flag2 = true;
                error4.setVisible(false);
                error6.setVisible(false);
                double a = Double.valueOf(textfield2.getText().trim()).doubleValue();
              } catch (NumberFormatException ex) {
                error4.setVisible(false);
                error6.setVisible(true);
                flag2 = false;
              }
            }

            if ((((String) combobox1.getSelectedItem()))
                .equals("<-----Please Choose a charge type----->")) {
              error5.setVisible(true);
              flag3 = false;
            } else {
              flag3 = true;
              error5.setVisible(false);
            }

            try {
              if (rightElArr.length >= 1) {

                flag4 = true;
                error7.setVisible(false);

              } else {
                flag4 = false;
                error7.setVisible(true);
              }
            } catch (NullPointerException npe) {
              flag4 = true;
            }

            if ((flag1 == true) && (flag2 == true) && (flag3 == true) && (flag4 == true)) {
              for (int i = 0; i < App.pkgList.size(); i++) {
                if (App.pkgList.get(i).getPkgCode().equalsIgnoreCase(PackagePanel.pkgtemp[0])) {
                  App.pkgList.get(i).setPkgName(textfield1.getText());
                  break;
                }
              }

              for (int i = 0; i < App.pkgList.size(); i++) {
                if (App.pkgList.get(i).getPkgCode().equalsIgnoreCase(PackagePanel.pkgtemp[0])) {
                  App.pkgList
                      .get(i)
                      .setChargePrice(Double.valueOf(textfield2.getText().trim()).doubleValue());
                  break;
                }
              }

              for (int i = 0; i < App.pkgList.size(); i++) {
                if (App.pkgList.get(i).getPkgCode().equalsIgnoreCase(PackagePanel.pkgtemp[0])) {
                  App.pkgList.get(i).setChargeType(combobox1.getSelectedItem().toString());
                  break;
                }
              }

              if (rightElArr != null) {
                for (int i = 0; i < App.pckgingList.size(); i++) {
                  if (App.pckgingList
                      .get(i)
                      .getPkgCode()
                      .equalsIgnoreCase(PackagePanel.pkgtemp[0])) {
                    App.pckgingList.remove(i);
                    i--;
                  }
                }

                for (int i = 0; i < rightElArr.length; i++) {
                  App.pckgingList.addLast(
                      new Packaging(PackagePanel.pkgtemp[0], (rightElArr[i]).substring(0, 4)));
                }
              } else {
                for (int i = 0; i < App.prgList.size(); i++) {
                  for (int j = 0; j < App.pckgingList.size(); j++) {
                    if (PackagePanel.pkgtemp[0].equalsIgnoreCase(
                        App.pckgingList.get(j).getPkgCode())) {
                      if (App.pckgingList
                          .get(j)
                          .getProgCode()
                          .equalsIgnoreCase(App.prgList.get(i).getProgCode())) {
                        selPrgList.add(App.pckgingList.get(j).getProgCode());
                        ((DefaultListModel) rightModel)
                            .addElement(
                                App.pckgingList.get(j).getProgCode()
                                    + "-"
                                    + App.prgList.get(i).getProgTitle());
                      }
                    }
                  }
                }
              }

              JOptionPane.showMessageDialog(
                  null,
                  "You have successfully changed the details of TV Package "
                      + PackagePanel.pkgtemp[0]
                      + " !",
                  PackagePanel.pkgtemp[0] + " edited",
                  JOptionPane.PLAIN_MESSAGE);
              LogFile log =
                  new LogFile(
                      App.user, "has edited a TV Package '" + PackagePanel.pkgtemp[0] + "'.");
              App.logList.add(log);
              dispose();
            }
          }
        });

    button2.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            int closeCf =
                JOptionPane.showConfirmDialog(
                    null,
                    "Stop Adding? All the changes will not be saved.",
                    "Cancel Adding",
                    JOptionPane.WARNING_MESSAGE);
            if (closeCf == JOptionPane.YES_OPTION) {
              dispose();
            }
          }
        });

    container.setLayout(spring);

    container.add(label1);
    container.add(textfield3);

    spring.putConstraint(SpringLayout.WEST, label1, 20, SpringLayout.WEST, container);
    spring.putConstraint(SpringLayout.NORTH, label1, 15, SpringLayout.NORTH, container);
    spring.putConstraint(SpringLayout.WEST, textfield3, 80, SpringLayout.EAST, label1);
    spring.putConstraint(SpringLayout.NORTH, textfield3, 15, SpringLayout.NORTH, container);

    container.add(label2);
    container.add(textfield1);
    container.add(error3);

    spring.putConstraint(SpringLayout.WEST, label2, 20, SpringLayout.WEST, container);
    spring.putConstraint(SpringLayout.NORTH, label2, 40, SpringLayout.SOUTH, label1);
    spring.putConstraint(SpringLayout.WEST, textfield1, 80, SpringLayout.EAST, label1);
    spring.putConstraint(SpringLayout.NORTH, textfield1, 30, SpringLayout.SOUTH, textfield3);
    spring.putConstraint(SpringLayout.NORTH, error3, -27, SpringLayout.SOUTH, textfield1);
    spring.putConstraint(SpringLayout.WEST, error3, 260, SpringLayout.EAST, label2);

    container.add(label3);
    container.add(textfield2);
    container.add(error4);
    container.add(error6);
    spring.putConstraint(SpringLayout.WEST, label3, 20, SpringLayout.WEST, container);
    spring.putConstraint(SpringLayout.NORTH, label3, 45, SpringLayout.SOUTH, label2);
    spring.putConstraint(SpringLayout.WEST, textfield2, 80, SpringLayout.EAST, label1);
    spring.putConstraint(SpringLayout.NORTH, textfield2, 30, SpringLayout.SOUTH, textfield1);
    spring.putConstraint(SpringLayout.NORTH, error4, -26, SpringLayout.SOUTH, textfield2);
    spring.putConstraint(SpringLayout.WEST, error4, 251, SpringLayout.EAST, label3);
    spring.putConstraint(SpringLayout.NORTH, error6, -26, SpringLayout.SOUTH, textfield2);
    spring.putConstraint(SpringLayout.WEST, error6, 251, SpringLayout.EAST, label3);

    container.add(label4);
    container.add(combobox1);
    container.add(error5);
    spring.putConstraint(SpringLayout.WEST, label4, 20, SpringLayout.WEST, container);
    spring.putConstraint(SpringLayout.NORTH, label4, 40, SpringLayout.SOUTH, label3);
    spring.putConstraint(SpringLayout.WEST, combobox1, 80, SpringLayout.EAST, label1);
    spring.putConstraint(SpringLayout.NORTH, combobox1, 30, SpringLayout.SOUTH, textfield2);
    spring.putConstraint(SpringLayout.NORTH, error5, -26, SpringLayout.SOUTH, combobox1);
    spring.putConstraint(SpringLayout.WEST, error5, 320, SpringLayout.EAST, label3);

    container.add(label5);
    container.add(label6);
    spring.putConstraint(SpringLayout.WEST, label5, 20, SpringLayout.WEST, container);
    spring.putConstraint(SpringLayout.NORTH, label5, 20, SpringLayout.SOUTH, label4);
    spring.putConstraint(SpringLayout.WEST, label6, 280, SpringLayout.EAST, label5);
    spring.putConstraint(SpringLayout.NORTH, label6, 20, SpringLayout.SOUTH, label4);

    container.add(leftListScroll);
    container.add(addBut);
    container.add(rmvBut);
    container.add(rightListScroll);
    container.add(error7);
    spring.putConstraint(SpringLayout.WEST, leftListScroll, 20, SpringLayout.WEST, container);
    spring.putConstraint(SpringLayout.NORTH, leftListScroll, 45, SpringLayout.SOUTH, label4);
    spring.putConstraint(SpringLayout.WEST, addBut, 35, SpringLayout.EAST, leftListScroll);
    spring.putConstraint(SpringLayout.NORTH, addBut, 52, SpringLayout.SOUTH, label4);
    spring.putConstraint(SpringLayout.WEST, rmvBut, 25, SpringLayout.EAST, leftListScroll);
    spring.putConstraint(SpringLayout.NORTH, rmvBut, 10, SpringLayout.SOUTH, addBut);
    spring.putConstraint(SpringLayout.WEST, rightListScroll, 24, SpringLayout.EAST, rmvBut);
    spring.putConstraint(SpringLayout.NORTH, rightListScroll, 45, SpringLayout.SOUTH, label4);
    spring.putConstraint(SpringLayout.WEST, error7, 40, SpringLayout.EAST, label4);
    spring.putConstraint(SpringLayout.NORTH, error7, 345, SpringLayout.SOUTH, label4);

    container.add(button1);
    container.add(button2);
    spring.putConstraint(SpringLayout.WEST, button1, 222, SpringLayout.WEST, container);
    spring.putConstraint(SpringLayout.NORTH, button1, 362, SpringLayout.SOUTH, combobox1);
    spring.putConstraint(SpringLayout.WEST, button2, 222, SpringLayout.EAST, label2);
    spring.putConstraint(SpringLayout.NORTH, button2, 362, SpringLayout.SOUTH, combobox1);

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setSize(690, 680);
    setLocation(300, 60);
    setVisible(true);
    PackagePanel.defaultButtonSet();
  }
Esempio n. 13
0
  /** creates a JTextfield with JLabel (contains labelText) and an identifier id */
  public TLangTextField(String labelText, int id, FieldPopup popup) {
    super();

    //    this.setOpaque( false ) ;
    this.setLayout(new OverlayLayout(this));
    //    this.setBorder( BorderFactory.createEtchedBorder());

    listenerList = new EventListenerList();

    // build the labeled textfield --------------------------------------------
    textField =
        new IDTextField(id, popup) {
          public void paint(Graphics g) {
            super.paint(g);

            if (currentImage != null) {
              Graphics2D g2 = (Graphics2D) g;
              g2.drawImage(currentImage, -8, -2, this);
            }

            //        System.out.println( "paint " +(counter++) ) ;
          }
        };

    textField.addKeyListener(this);
    textField.addFocusListener(this);
    textField.setPopupName(labelText);
    textField.setMaximumSize(new Dimension(2000, 30));
    textField.setFont(GUIGlobals.defaultLanguageFont);

    // charat position
    leerInsets = textField.getMargin();

    label = new JLabel(labelText, JLabel.TRAILING);
    label.setLabelFor(textField);
    label.addFocusListener(this);

    // insert label and textfield
    layout = new SpringLayout();
    bigPanel = new JPanel(layout);
    //    bigPanel.setOpaque( false ) ;

    bigPanel.add(label);
    bigPanel.add(textField);

    // Adjust constraints for the label so it's at (5,5).
    layout.putConstraint(SpringLayout.WEST, label, 10, SpringLayout.WEST, bigPanel);
    layout.putConstraint(SpringLayout.NORTH, label, 6, SpringLayout.NORTH, bigPanel);

    // Adjust constraints for the text field so it's at
    // (<label's right edge> + 5, 5).
    layout.putConstraint(SpringLayout.WEST, textField, 10, SpringLayout.EAST, label);
    layout.putConstraint(SpringLayout.NORTH, textField, -2, SpringLayout.NORTH, label);

    // Adjust constraints for the content pane: Its right
    // edge should be 5 pixels beyond the text field's right
    // edge, and its bottom edge should be 5 pixels beyond
    // the bottom edge of the tallest component (which we'll
    // assume is textField).
    layout.putConstraint(SpringLayout.EAST, bigPanel, 5, SpringLayout.EAST, textField);
    layout.putConstraint(
        SpringLayout.SOUTH,
        bigPanel,
        //                          8,
        //                          SpringLayout.SOUTH, label ) ;
        5,
        SpringLayout.SOUTH,
        textField);

    // build image section ----------------------------------------------------
    imageLabel = new JLabel();
    imageLabel.setOpaque(false);
    fieldState = REQUIRE_STATE;
    setImage();
    textField.other = imageLabel;

    // insert image and labeled-field -----------------------------------------
    this.add(imageLabel);
    this.add(bigPanel);

    // pipe all focus events to local class methods
    super.addFocusListener(this);
  }
Esempio n. 14
0
  private static void createAndShowGUI() {
    JFrame frame = new JFrame("Fractal");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    SpringLayout layout = new SpringLayout();
    frame.setLayout(layout);

    Orientation nw = new Orientation();
    nw.setOffset(0, 0);
    Orientation sw = new Orientation();
    sw.setOffset(0, regionSize);
    Orientation se = new Orientation();
    se.setOffset(regionSize, regionSize);

    Fractal fractal = new Fractal(regionSize);
    fractal.setOrientations(nw, sw, se);

    layout.putConstraint(SpringLayout.WEST, fractal, 5, SpringLayout.WEST, frame.getContentPane());
    layout.putConstraint(
        SpringLayout.NORTH, fractal, 5, SpringLayout.NORTH, frame.getContentPane());

    layout.putConstraint(SpringLayout.WEST, nw, 5, SpringLayout.EAST, fractal);
    layout.putConstraint(SpringLayout.NORTH, nw, 0, SpringLayout.NORTH, fractal);

    layout.putConstraint(SpringLayout.NORTH, sw, 5, SpringLayout.SOUTH, nw);
    layout.putConstraint(SpringLayout.WEST, sw, 0, SpringLayout.WEST, nw);

    layout.putConstraint(SpringLayout.NORTH, se, 5, SpringLayout.SOUTH, nw);
    layout.putConstraint(SpringLayout.WEST, se, 5, SpringLayout.EAST, sw);

    layout.putConstraint(
        SpringLayout.SOUTH, frame.getContentPane(), 5, SpringLayout.SOUTH, fractal);
    layout.putConstraint(SpringLayout.EAST, frame.getContentPane(), 5, SpringLayout.EAST, se);

    frame.add(nw);
    frame.add(sw);
    frame.add(se);

    frame.add(fractal);

    frame.setResizable(false);
    frame.pack();
    frame.setVisible(true);
  }
Esempio n. 15
0
 private void initRound() {
   SpringLayout mainLayout = new SpringLayout();
   setLayout(mainLayout);
   resultButton.setEnabled(false);
   betButton.setEnabled(true);
   inputImage.add(betInput);
   controlPanel.add(betLabel);
   controlPanel.add(inputImage);
   controlPanel.add(betButton);
   add(recordLabel);
   add(record);
   add(dealerPanel);
   add(playerPanel);
   add(controlPanel);
   add(moneyLabel);
   add(money);
   add(resultButton);
   mainLayout.putConstraint(SpringLayout.WEST, recordLabel, 154, SpringLayout.WEST, this);
   mainLayout.putConstraint(SpringLayout.NORTH, recordLabel, 20, SpringLayout.NORTH, this);
   mainLayout.putConstraint(SpringLayout.NORTH, record, 15, SpringLayout.NORTH, this);
   mainLayout.putConstraint(SpringLayout.WEST, record, 20, SpringLayout.EAST, recordLabel);
   mainLayout.putConstraint(SpringLayout.WEST, dealerPanel, 180, SpringLayout.WEST, this);
   mainLayout.putConstraint(SpringLayout.NORTH, dealerPanel, 70, SpringLayout.NORTH, this);
   mainLayout.putConstraint(SpringLayout.WEST, playerPanel, 180, SpringLayout.WEST, this);
   mainLayout.putConstraint(SpringLayout.NORTH, playerPanel, 10, SpringLayout.SOUTH, dealerPanel);
   mainLayout.putConstraint(SpringLayout.SOUTH, moneyLabel, -20, SpringLayout.SOUTH, this);
   mainLayout.putConstraint(SpringLayout.WEST, moneyLabel, 5, SpringLayout.WEST, this);
   mainLayout.putConstraint(SpringLayout.WEST, money, 20, SpringLayout.EAST, moneyLabel);
   mainLayout.putConstraint(SpringLayout.SOUTH, money, -15, SpringLayout.SOUTH, this);
   mainLayout.putConstraint(SpringLayout.SOUTH, resultButton, -13, SpringLayout.SOUTH, this);
   mainLayout.putConstraint(SpringLayout.EAST, resultButton, -70, SpringLayout.EAST, this);
   mainLayout.putConstraint(
       SpringLayout.SOUTH, controlPanel, -5, SpringLayout.NORTH, resultButton);
   assignCards();
   numReplaced = 0;
   betInput.setText(null);
   betInput.requestFocusInWindow();
 }