/** Updates the available table entries */
  private void updateAvailableTable() {
    final List mAvailableData = new ArrayList();

    for (Iterator it = mAvailableList.iterator(); it.hasNext(); ) {
      mAvailableData.add(it.next().toString());
    }

    setData(mAvailableData);

    int row = avaRadioButton.length;

    GridBagLayout gridbag = new GridBagLayout();
    avaPane.removeAll();
    avaPane.setLayout(gridbag);

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;

    for (int i = 0; i < row; ++i) {
      int cr = i;
      c.anchor = GridBagConstraints.WEST;
      Utility.buildConstraints(c, 0, cr, 2, 1, 1, 0);
      gridbag.setConstraints(avaRadioButton[i], c);
      avaPane.add(avaRadioButton[i]);

      // if there are more than 10 items make a double row
      if ((row > 11) && (i < (row - 1))) {
        ++i;
        c.anchor = GridBagConstraints.EAST;
        Utility.buildConstraints(c, 3, cr, 2, 1, 1, 0);
        gridbag.setConstraints(avaRadioButton[i], c);
        avaPane.add(avaRadioButton[i]);
      }
    }

    if (lblCombo != null) {
      Utility.buildConstraints(c, 0, row, 3, 1, 0, 0);
      gridbag.setConstraints(lblCombo, c);
      avaPane.add(lblCombo);

      Utility.buildConstraints(c, 0, row + 1, 3, 1, 0, 0);
      gridbag.setConstraints(cmbCombo, c);
      avaPane.add(cmbCombo);
    }
  }
Exemple #2
0
  public void initialize() {
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    getContentPane().setLayout(gridbag);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets = new Insets(2, 2, 2, 2);

    int col = 0;
    Utility.buildConstraints(c, col, 0, 1, 1, 100, 20);
    JLabel label =
        new JLabel(LanguageBundle.getFormattedString("in_SolverView_Perspective")); // $NON-NLS-1$
    gridbag.setConstraints(label, c);
    getContentPane().add(label);

    Utility.buildConstraints(c, col++, 1, 1, 1, 0, 20);
    gridbag.setConstraints(identifierChooser, c);
    getContentPane().add(identifierChooser);

    Utility.buildConstraints(c, col++, 1, 1, 1, 0, 20);
    gridbag.setConstraints(scopeChooser, c);
    getContentPane().add(scopeChooser);

    Utility.buildConstraints(c, col++, 1, 1, 1, 0, 20);
    gridbag.setConstraints(objectChooser, c);
    getContentPane().add(objectChooser);

    Utility.buildConstraints(c, col++, 1, 1, 1, 0, 20);
    label =
        new JLabel(
            LanguageBundle.getFormattedString("in_SolverView_VarName") // $NON-NLS-1$
            );
    gridbag.setConstraints(label, c);
    getContentPane().add(label);

    Utility.buildConstraints(c, col++, 1, 1, 1, 0, 20);
    gridbag.setConstraints(varName, c);
    getContentPane().add(varName);

    tableModel = new SolverTableModel();
    viewTable = new JTable(tableModel);

    viewTable.getColumnModel().getColumn(0).setPreferredWidth(25);
    viewTable.getColumnModel().getColumn(1).setPreferredWidth(50);
    viewTable.getColumnModel().getColumn(2).setPreferredWidth(25);
    viewTable.getColumnModel().getColumn(3).setPreferredWidth(50);

    Utility.buildConstraints(c, 0, 2, col, 1, 0, 1000);
    JScrollPane pane = new JScrollPane(viewTable);
    viewTable.setFillsViewportHeight(true);
    pane.setPreferredSize(new Dimension(500, 300));
    gridbag.setConstraints(pane, c);
    getContentPane().add(pane);

    setTitle("Core Variable Debug View");
    getContentPane().setSize(500, 400);
    pack();
    Utility.centerFrame(this, true);
  }
Exemple #3
0
  /** Instantiates a new Tabs panel. */
  public TabsPanel() {
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    JLabel label;
    Border etched = null;
    TitledBorder title1 = BorderFactory.createTitledBorder(etched, in_tabs);

    title1.setTitleJustification(TitledBorder.LEFT);
    this.setBorder(title1);
    gridbag = new GridBagLayout();
    this.setLayout(gridbag);
    c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(2, 2, 2, 2);

    Utility.buildConstraints(c, 0, 0, 2, 1, 0, 0);
    label = new JLabel(in_mainTabPlacement + ": ");
    gridbag.setConstraints(label, c);
    this.add(label);
    Utility.buildConstraints(c, 2, 0, 1, 1, 0, 0);
    mainTabPlacementCombo =
        new JComboBoxEx(
            new String[] {in_tabPosTop, in_tabPosBottom, in_tabPosLeft, in_tabPosRight});
    gridbag.setConstraints(mainTabPlacementCombo, c);
    this.add(mainTabPlacementCombo);

    Utility.buildConstraints(c, 0, 1, 2, 1, 0, 0);
    label = new JLabel(in_charTabPlacement + ": ");
    gridbag.setConstraints(label, c);
    this.add(label);
    Utility.buildConstraints(c, 2, 1, 1, 1, 0, 0);
    charTabPlacementCombo =
        new JComboBoxEx(
            new String[] {in_tabPosTop, in_tabPosBottom, in_tabPosLeft, in_tabPosRight});
    gridbag.setConstraints(charTabPlacementCombo, c);
    this.add(charTabPlacementCombo);

    Utility.buildConstraints(c, 0, 2, 2, 1, 0, 0);
    label = new JLabel(in_charTabLabel + ": ");
    gridbag.setConstraints(label, c);
    this.add(label);
    Utility.buildConstraints(c, 2, 2, 1, 1, 0, 0);
    tabLabelsCombo =
        new JComboBoxEx(
            new String[] {
              in_tabLabelPlain,
              in_tabLabelEpic,
              in_tabLabelRace,
              in_tabLabelNetHack,
              in_tabLabelFull
            });
    gridbag.setConstraints(tabLabelsCombo, c);
    this.add(tabLabelsCombo);

    Utility.buildConstraints(c, 0, 3, 2, 1, 0, 0);
    label = new JLabel(in_tabAbilities + ": ");
    gridbag.setConstraints(label, c);
    this.add(label);
    Utility.buildConstraints(c, 2, 3, 1, 1, 0, 0);
    gridbag.setConstraints(displayAbilitiesAsTab, c);
    this.add(displayAbilitiesAsTab);

    Utility.buildConstraints(c, 0, 4, 2, 1, 0, 0);
    label = new JLabel(in_expertGUI + ": ");
    gridbag.setConstraints(label, c);
    this.add(label);
    Utility.buildConstraints(c, 2, 4, 1, 1, 0, 0);
    gridbag.setConstraints(expertGUICheckBox, c);
    this.add(expertGUICheckBox);

    expertGUICheckBox.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent evt) {
            SettingsHandler.setExpertGUI(expertGUICheckBox.isSelected());
          }
        });

    Utility.buildConstraints(c, 5, 20, 1, 1, 1, 1);
    c.fill = GridBagConstraints.BOTH;
    label = new JLabel(" ");
    gridbag.setConstraints(label, c);
    this.add(label);
  }
  /** Initializes the components of the dialog */
  private void initComponents() {
    // Initialize basic dialog settings
    setModal(true);

    // setSize(new Dimension(240, 400));
    // setTitle(in_chooser);
    final Container contentPane = getContentPane();
    contentPane.setLayout(new GridBagLayout());

    TitledBorder title = BorderFactory.createTitledBorder(null, "Select One");
    avaPane.setBorder(title);

    // Create these labels with " " to force them to layout correctly
    mMessageText = new JLabelPane();
    mMessageText.setBackground(contentPane.getBackground());
    setMessageText(null);

    // Create buttons
    okButton = new JButton(in_ok);
    okButton.setMnemonic(LanguageBundle.getMnemonic("in_mn_ok"));
    cancelButton = new JButton(in_cancel);
    cancelButton.setMnemonic(LanguageBundle.getMnemonic("in_mn_cancel"));

    final ActionListener eventListener =
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            if (evt.getSource() == okButton) {
              selectedOK();
            } else if (evt.getSource() == cancelButton) {
              close();
            }
          }
        };

    okButton.addActionListener(eventListener);
    cancelButton.addActionListener(eventListener);

    // Add controls to content pane
    GridBagConstraints c;

    // Add message text
    c = new GridBagConstraints();
    Utility.buildConstraints(c, 0, 0, 3, 1, 0, 0);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 4, 4, 4);
    contentPane.add(mMessageText, c);

    // Add available list
    c = new GridBagConstraints();
    Utility.buildConstraints(c, 0, 1, 3, 1, 1, 1);
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(4, 4, 4, 4);
    JScrollPane avaScrollPane = new JScrollPane();
    avaScrollPane.setViewportView(avaPane);
    contentPane.add(avaScrollPane, c);

    // Add 'OK' and 'Cancel buttons
    JPanel btnPanel = new JPanel();
    btnPanel.setLayout(new BoxLayout(btnPanel, BoxLayout.X_AXIS));
    btnPanel.add(Box.createHorizontalGlue());
    btnPanel.add(okButton);
    btnPanel.add(Box.createHorizontalStrut(3));
    btnPanel.add(cancelButton);
    c = new GridBagConstraints();
    Utility.buildConstraints(c, 0, 2, 3, 1, 0, 0);
    c.anchor = GridBagConstraints.EAST;
    c.insets = new Insets(0, 4, 4, 4);
    contentPane.add(btnPanel, c);

    okButton.setEnabled(true);
    cancelButton.setEnabled(true);

    Utility.installEscapeCloseOperation(this);
  }