private void createComponents(JPanel p) {
    String tt = "Any of these:  45.5 -120.2   or   45 30 0 n 120 12 0 w   or   Seattle";

    JComboBox field = new JComboBox();
    field.setOpaque(false);
    field.setEditable(true);
    field.setLightWeightPopupEnabled(false);
    field.setPreferredSize(new Dimension(200, field.getPreferredSize().height));
    field.setToolTipText(tt);

    JLabel label = new JLabel(ImageLibrary.getIcon("gov/nasa/worldwindow/images/safari-24x24.png"));
    //            new
    // ImageIcon(getClass().getResource("gov/nasa/worldwindow/images/safari-24x24.png")));
    label.setOpaque(false);
    label.setToolTipText(tt);

    p.add(label, BorderLayout.WEST);
    p.add(field, BorderLayout.CENTER);

    field.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            performGazeteerAction(actionEvent);
          }
        });
  }
Beispiel #2
0
  DropdownImp() {
    b.setOpaque(false);

    b.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent ie) {
            if (ie.getStateChange() != ItemEvent.SELECTED
                && onSelectionChange != null
                && !selecting) {
              getInterface().getOwner().getCallbackHandler().callHandleErrors(onSelectionChange);
            }
          }
        });
    add(b);
  }
  /**
   * Constructeur de la classe
   *
   * @param numJoueur rang du joueur dans la liste des joueurs
   */
  public CadranSaisieInfoOrdinateur(int numJoueur) {

    this.setOpaque(false);
    this.setLayout(null);

    imageCadran.setIcon(
        new ImageIcon(getClass().getResource("/CadranJoueur" + numJoueur + ".png")));
    this.add(imageCadran);
    imageCadran.setBounds(0, 0, 160, 150);

    strategie.setOpaque(false);
    strategie.setFont(new java.awt.Font("Wawati SC", 0, 13));
    strategie.setBounds(3, 112, 150, 33);
    this.add(strategie, 0);

    strategie.setModel(
        new javax.swing.DefaultComboBoxModel(
            new String[] {"Agressif", "Agressif avec Bluff", "Normal", "Passif"}));
  }
  /**
   * Create a choicebox for link line style options and return the panel it is in.
   *
   * @return JPanel the panel holding the new choicebox for the link style options.
   */
  private JPanel createLinkDashedChoiceBox() {

    JPanel drawPanel = new JPanel(new BorderLayout());
    CSH.setHelpIDString(drawPanel, "toolbars.formatlink"); // $NON-NLS-1$

    cbLinkDashed = new JComboBox();
    cbLinkDashed.setToolTipText(
        LanguageProperties.getString(
            LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.selectDashed")); // $NON-NLS-1$
    cbLinkDashed.setOpaque(true);
    cbLinkDashed.setEditable(false);
    cbLinkDashed.setEnabled(false);
    cbLinkDashed.setMaximumRowCount(10);
    cbLinkDashed.setFont(new Font("Dialog", Font.PLAIN, 10)); // $NON-NLS-1$

    cbLinkDashed.addItem(
        new String(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE,
                "UIToolBarFormatLink.plainLine"))); //$NON-NLS-1$
    cbLinkDashed.addItem(
        new String(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE,
                "UIToolBarFormatLink.largeDashes"))); //$NON-NLS-1$
    cbLinkDashed.addItem(
        new String(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE,
                "UIToolBarFormatLink.smallDashes"))); //$NON-NLS-1$

    cbLinkDashed.validate();

    cbLinkDashed.setSelectedIndex(0);

    DefaultListCellRenderer drawRenderer =
        new DefaultListCellRenderer() {
          public Component getListCellRendererComponent(
              JList list, Object value, int modelIndex, boolean isSelected, boolean cellHasFocus) {
            if (list != null) {
              if (isSelected) {
                setBackground(list.getSelectionBackground());
                setForeground(list.getSelectionForeground());
              } else {
                setBackground(list.getBackground());
                setForeground(list.getForeground());
              }
            }

            setText((String) value);
            return this;
          }
        };

    cbLinkDashed.setRenderer(drawRenderer);

    ActionListener drawActionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            onUpdateLinkDashed(cbLinkDashed.getSelectedIndex());
          }
        };
    cbLinkDashed.addActionListener(drawActionListener);

    drawPanel.add(new JLabel(" "), BorderLayout.WEST); // $NON-NLS-1$
    drawPanel.add(cbLinkDashed, BorderLayout.CENTER);
    return drawPanel;
  }
  /**
   * Create a choicbox for link line thickness options and return the panel it is in.
   *
   * @return JPanel the panel holding the new choicebox for the line thickness options.
   */
  private JPanel createWeightChoiceBox() {

    JPanel drawPanel = new JPanel(new BorderLayout());
    CSH.setHelpIDString(drawPanel, "toolbars.formatlink"); // $NON-NLS-1$

    cbLineWeight = new JComboBox();
    cbLineWeight.setToolTipText(
        LanguageProperties.getString(
            LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.selectWeight")); // $NON-NLS-1$
    cbLineWeight.setOpaque(true);
    cbLineWeight.setEditable(false);
    cbLineWeight.setEnabled(false);
    cbLineWeight.setMaximumRowCount(10);
    cbLineWeight.setFont(new Font("Dialog", Font.PLAIN, 10)); // $NON-NLS-1$

    cbLineWeight.addItem(new String("1 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("2 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("3 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("4 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("5 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("6 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("7 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("8 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("9 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("10 px")); // $NON-NLS-1$

    cbLineWeight.validate();

    cbLineWeight.setSelectedIndex(0);

    DefaultListCellRenderer drawRenderer =
        new DefaultListCellRenderer() {
          public Component getListCellRendererComponent(
              JList list, Object value, int modelIndex, boolean isSelected, boolean cellHasFocus) {
            if (list != null) {
              if (isSelected) {
                setBackground(list.getSelectionBackground());
                setForeground(list.getSelectionForeground());
              } else {
                setBackground(list.getBackground());
                setForeground(list.getForeground());
              }
            }

            setText((String) value);
            return this;
          }
        };

    cbLineWeight.setRenderer(drawRenderer);

    ActionListener drawActionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int ind = cbLineWeight.getSelectedIndex();

            if (ind == 0) onUpdateLinkWeight(1);
            else if (ind == 1) onUpdateLinkWeight(2);
            else if (ind == 2) onUpdateLinkWeight(3);
            else if (ind == 3) onUpdateLinkWeight(4);
            else if (ind == 4) onUpdateLinkWeight(5);
            else if (ind == 5) onUpdateLinkWeight(6);
            else if (ind == 6) onUpdateLinkWeight(7);
            else if (ind == 7) onUpdateLinkWeight(8);
            else if (ind == 8) onUpdateLinkWeight(9);
            else if (ind == 9) onUpdateLinkWeight(10);
          }
        };
    cbLineWeight.addActionListener(drawActionListener);

    drawPanel.add(new JLabel(" "), BorderLayout.WEST); // $NON-NLS-1$
    drawPanel.add(cbLineWeight, BorderLayout.CENTER);
    return drawPanel;
  }
  /** Create the arrow head choicebox. */
  private JPanel createArrowChoiceBox() {

    JPanel drawPanel = new JPanel(new BorderLayout());
    CSH.setHelpIDString(drawPanel, "toolbars.formatlink"); // $NON-NLS-1$

    cbArrows = new JComboBox();
    cbArrows.setToolTipText(
        LanguageProperties.getString(
            LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.selectArrow")); // $NON-NLS-1$
    cbArrows.setOpaque(true);
    cbArrows.setEditable(false);
    cbArrows.setEnabled(false);
    cbArrows.setMaximumRowCount(4);
    cbArrows.setFont(new Font("Dialog", Font.PLAIN, 10)); // $NON-NLS-1$

    Vector arrows = new Vector(5);
    arrows.insertElementAt(
        LanguageProperties.getString(
            LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.noArrows"),
        0); //$NON-NLS-1$
    arrows.insertElementAt(
        LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.fromTo"),
        1); //$NON-NLS-1$
    arrows.insertElementAt(
        LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.toFfrom"),
        2); //$NON-NLS-1$
    arrows.insertElementAt(
        LanguageProperties.getString(
            LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.bothWays"),
        3); //$NON-NLS-1$
    DefaultComboBoxModel comboModel = new DefaultComboBoxModel(arrows);
    cbArrows.setModel(comboModel);
    cbArrows.setSelectedIndex(0);

    DefaultListCellRenderer comboRenderer =
        new DefaultListCellRenderer() {
          public Component getListCellRendererComponent(
              JList list, Object value, int modelIndex, boolean isSelected, boolean cellHasFocus) {
            if (isSelected) {
              setBackground(list.getSelectionBackground());
              setForeground(list.getSelectionForeground());
            } else {
              setBackground(list.getBackground());
              setForeground(list.getForeground());
            }

            setText((String) value);

            return this;
          }
        };
    cbArrows.setRenderer(comboRenderer);

    cbArrows.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            onUpdateArrowType(cbArrows.getSelectedIndex());
          }
        });

    drawPanel.add(new JLabel(" "), BorderLayout.WEST); // $NON-NLS-1$
    drawPanel.add(cbArrows, BorderLayout.CENTER);
    return drawPanel;
  }
  /** Display a frame for browsing issues. */
  private JPanel constructView() {
    // sort the original issues list
    final SortedList<Issue> issuesSortedList = new SortedList<Issue>(issuesEventList, null);

    // filter the sorted issues
    FilterList<Issue> filteredIssues =
        new FilterList<Issue>(issuesSortedList, filterPanel.getMatcherEditor());

    SeparatorList<Issue> separatedIssues =
        new SeparatorList<Issue>(
            filteredIssues,
            GlazedLists.beanPropertyComparator(Issue.class, "subcomponent"),
            0,
            Integer.MAX_VALUE);
    EventList<Issue> separatedIssuesProxyList =
        GlazedListsSwing.swingThreadProxyList(separatedIssues);
    // build the issues table
    issuesTableModel =
        GlazedListsSwing.eventTableModel(separatedIssuesProxyList, new IssueTableFormat());
    final TableColumnModel issuesTableColumnModel =
        new EventTableColumnModel<TableColumn>(new BasicEventList<TableColumn>());
    JSeparatorTable issuesJTable = new JSeparatorTable(issuesTableModel, issuesTableColumnModel);
    issuesJTable.setAutoCreateColumnsFromModel(true);

    issuesJTable.setSeparatorRenderer(new IssueSeparatorTableCell(separatedIssues));
    issuesJTable.setSeparatorEditor(new IssueSeparatorTableCell(separatedIssues));
    issuesSelectionModel = GlazedListsSwing.eventSelectionModel(separatedIssuesProxyList);
    issuesSelectionModel.setSelectionMode(
        ListSelection
            .MULTIPLE_INTERVAL_SELECTION_DEFENSIVE); // multi-selection best demos our awesome
                                                     // selection management
    issuesSelectionModel.addListSelectionListener(new IssuesSelectionListener());
    issuesJTable.setSelectionModel(issuesSelectionModel);
    issuesJTable.getColumnModel().getColumn(0).setPreferredWidth(150);
    issuesJTable.getColumnModel().getColumn(1).setPreferredWidth(400);
    issuesJTable.getColumnModel().getColumn(2).setPreferredWidth(300);
    issuesJTable.getColumnModel().getColumn(3).setPreferredWidth(300);
    issuesJTable.getColumnModel().getColumn(4).setPreferredWidth(250);
    issuesJTable.getColumnModel().getColumn(5).setPreferredWidth(300);
    issuesJTable.getColumnModel().getColumn(6).setPreferredWidth(300);
    issuesJTable.getColumnModel().getColumn(7).setPreferredWidth(1000);
    // turn off cell focus painting
    issuesJTable.setDefaultRenderer(
        String.class, new NoFocusRenderer(issuesJTable.getDefaultRenderer(String.class)));
    issuesJTable.setDefaultRenderer(
        Integer.class, new NoFocusRenderer(issuesJTable.getDefaultRenderer(Integer.class)));
    issuesJTable.setDefaultRenderer(
        Priority.class, new NoFocusRenderer(new PriorityTableCellRenderer()));
    LookAndFeelTweaks.tweakTable(issuesJTable);
    TableComparatorChooser.install(
        issuesJTable, issuesSortedList, TableComparatorChooser.MULTIPLE_COLUMN_KEYBOARD);
    JScrollPane issuesTableScrollPane =
        new JScrollPane(
            issuesJTable,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    issuesTableScrollPane.getViewport().setBackground(UIManager.getColor("EditorPane.background"));
    issuesTableScrollPane.setBorder(BorderFactory.createEmptyBorder());

    issueDetails = new IssueDetailsComponent(filteredIssues);

    // projects
    EventList<Project> projects = Project.getProjects();
    TransformedList<Project, Project> projectsProxyList =
        GlazedListsSwing.swingThreadProxyList(projects);
    // project select combobox
    DefaultEventComboBoxModel projectsComboModel =
        new DefaultEventComboBoxModel<Project>(projectsProxyList);
    JComboBox projectsCombo = new JComboBox(projectsComboModel);
    projectsCombo.setEditable(false);
    projectsCombo.setOpaque(false);
    projectsCombo.addItemListener(new ProjectChangeListener());
    projectsComboModel.setSelectedItem(new Project(null, "Select a Java.net project..."));

    // build a label to display the number of issues in the issue table
    issueCounter = new IssueCounterLabel(filteredIssues);
    issueCounter.setHorizontalAlignment(SwingConstants.CENTER);
    issueCounter.setForeground(Color.WHITE);

    // throbber
    throbber = new JLabel(THROBBER_STATIC);
    throbber.setHorizontalAlignment(SwingConstants.RIGHT);

    // header bar
    JPanel iconBar = new GradientPanel(GLAZED_LISTS_MEDIUM_BROWN, GLAZED_LISTS_DARK_BROWN, true);
    iconBar.setLayout(new GridLayout(1, 3));
    iconBar.add(projectsCombo);
    iconBar.add(issueCounter);
    iconBar.add(throbber);
    iconBar.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    // assemble all data components on a common panel
    JPanel dataPanel = new JPanel();
    JComponent issueDetailsComponent = issueDetails;
    dataPanel.setLayout(new GridLayout(2, 1));
    dataPanel.add(issuesTableScrollPane);
    dataPanel.add(issueDetailsComponent);

    // draw lines between components
    JComponent filtersPanel = filterPanel.getComponent();
    filtersPanel.setBorder(BorderFactory.createEmptyBorder());
    // filtersPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1,
    // IssuesBrowser.GLAZED_LISTS_DARK_BROWN));
    issueDetailsComponent.setBorder(
        BorderFactory.createMatteBorder(1, 0, 0, 0, GLAZED_LISTS_DARK_BROWN));

    // the outermost panel to layout the icon bar with the other panels
    final JPanel mainPanel = new JPanel(new GridBagLayout());
    mainPanel.add(
        iconBar,
        new GridBagConstraints(
            0,
            0,
            2,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));
    mainPanel.add(
        filtersPanel,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));
    mainPanel.add(
        Box.createHorizontalStrut(240),
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));
    mainPanel.add(
        dataPanel,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));

    return mainPanel;
  }
Beispiel #8
0
  public ParameterTablePanel(
      Project project, VariableData[] variableData, final PsiElement... scopeElements) {
    super(new BorderLayout());
    myProject = project;
    myVariableData = variableData;

    myTableModel = new MyTableModel();
    myTable = new JBTable(myTableModel);
    DefaultCellEditor defaultEditor = (DefaultCellEditor) myTable.getDefaultEditor(Object.class);
    defaultEditor.setClickCountToStart(1);

    myTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    myTable.setCellSelectionEnabled(true);
    TableColumn checkboxColumn = myTable.getColumnModel().getColumn(MyTableModel.CHECKMARK_COLUMN);
    TableUtil.setupCheckboxColumn(checkboxColumn);
    checkboxColumn.setCellRenderer(new CheckBoxTableCellRenderer());
    myTable
        .getColumnModel()
        .getColumn(MyTableModel.PARAMETER_NAME_COLUMN)
        .setCellRenderer(
            new DefaultTableCellRenderer() {
              public Component getTableCellRendererComponent(
                  JTable table,
                  Object value,
                  boolean isSelected,
                  boolean hasFocus,
                  int row,
                  int column) {
                super.getTableCellRendererComponent(
                    table, value, isSelected, hasFocus, row, column);
                VariableData data = getVariableData()[row];
                setText(data.name);
                return this;
              }
            });

    myParameterTypeSelectors = new TypeSelector[getVariableData().length];
    for (int i = 0; i < myParameterTypeSelectors.length; i++) {
      final PsiVariable variable = getVariableData()[i].variable;
      final PsiExpression[] occurrences = findVariableOccurrences(scopeElements, variable);
      final TypeSelectorManager manager =
          new TypeSelectorManagerImpl(
              myProject, getVariableData()[i].type, occurrences, areTypesDirected()) {
            @Override
            protected boolean isUsedAfter() {
              return ParameterTablePanel.this.isUsedAfter(variable);
            }
          };
      myParameterTypeSelectors[i] = manager.getTypeSelector();
      getVariableData()[i].type = myParameterTypeSelectors[i].getSelectedType(); // reverse order
    }

    myTypeRendererCombo = new JComboBox(getVariableData());
    myTypeRendererCombo.setOpaque(true);
    myTypeRendererCombo.setBorder(null);
    myTypeRendererCombo.setRenderer(
        new ListCellRendererWrapper<VariableData>() {
          @Override
          public void customize(
              JList list, VariableData value, int index, boolean selected, boolean hasFocus) {
            if (value != null) {
              setText(value.type.getPresentableText());
            }
          }
        });

    final TableColumn typeColumn =
        myTable.getColumnModel().getColumn(MyTableModel.PARAMETER_TYPE_COLUMN);
    typeColumn.setCellEditor(
        new AbstractTableCellEditor() {
          TypeSelector myCurrentSelector;
          final JBComboBoxTableCellEditorComponent myEditorComponent =
              new JBComboBoxTableCellEditorComponent();

          @Nullable
          public Object getCellEditorValue() {
            return myEditorComponent.getEditorValue();
          }

          public Component getTableCellEditorComponent(
              final JTable table,
              final Object value,
              final boolean isSelected,
              final int row,
              final int column) {
            myEditorComponent.setCell(table, row, column);
            myEditorComponent.setOptions(myParameterTypeSelectors[row].getTypes());
            myEditorComponent.setDefaultValue(getVariableData()[row].type);
            myEditorComponent.setToString(
                new Function<Object, String>() {
                  @Override
                  public String fun(Object o) {
                    return ((PsiType) o).getPresentableText();
                  }
                });

            myCurrentSelector = myParameterTypeSelectors[row];
            return myEditorComponent;
          }
        });

    myTable
        .getColumnModel()
        .getColumn(MyTableModel.PARAMETER_TYPE_COLUMN)
        .setCellRenderer(
            new DefaultTableCellRenderer() {
              private JBComboBoxLabel myLabel = new JBComboBoxLabel();

              public Component getTableCellRendererComponent(
                  JTable table,
                  Object value,
                  boolean isSelected,
                  boolean hasFocus,
                  int row,
                  int column) {
                myLabel.setText(String.valueOf(value));
                myLabel.setBackground(
                    isSelected ? table.getSelectionBackground() : table.getBackground());
                myLabel.setForeground(
                    isSelected ? table.getSelectionForeground() : table.getForeground());
                if (isSelected) {
                  myLabel.setSelectionIcon();
                } else {
                  myLabel.setRegularIcon();
                }
                return myLabel;
              }
            });

    myTable.setPreferredScrollableViewportSize(new Dimension(250, myTable.getRowHeight() * 5));
    myTable.setShowGrid(false);
    myTable.setIntercellSpacing(new Dimension(0, 0));
    @NonNls final InputMap inputMap = myTable.getInputMap();
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "enable_disable");
    @NonNls final ActionMap actionMap = myTable.getActionMap();
    actionMap.put(
        "enable_disable",
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            if (myTable.isEditing()) return;
            int[] rows = myTable.getSelectedRows();
            if (rows.length > 0) {
              boolean valueToBeSet = false;
              for (int row : rows) {
                if (!getVariableData()[row].passAsParameter) {
                  valueToBeSet = true;
                  break;
                }
              }
              for (int row : rows) {
                getVariableData()[row].passAsParameter = valueToBeSet;
              }
              myTableModel.fireTableRowsUpdated(rows[0], rows[rows.length - 1]);
              TableUtil.selectRows(myTable, rows);
            }
          }
        });
    //// F2 should edit the name
    // inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0), "edit_parameter_name");
    // actionMap.put("edit_parameter_name", new AbstractAction() {
    //  public void actionPerformed(ActionEvent e) {
    //    if (!myTable.isEditing()) {
    //      int row = myTable.getSelectedRow();
    //      if (row >= 0 && row < myTableModel.getRowCount()) {
    //        TableUtil.editCellAt(myTable, row, MyTableModel.PARAMETER_NAME_COLUMN);
    //      }
    //    }
    //  }
    // });

    //// make ENTER work when the table has focus
    // inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "invokeImpl");
    // actionMap.put("invokeImpl", new AbstractAction() {
    //  public void actionPerformed(ActionEvent e) {
    //    TableCellEditor editor = myTable.getCellEditor();
    //    if (editor != null) {
    //      editor.stopCellEditing();
    //    }
    //    else {
    //      doEnterAction();
    //    }
    //  }
    // });

    // make ESCAPE work when the table has focus
    actionMap.put(
        "doCancel",
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            TableCellEditor editor = myTable.getCellEditor();
            if (editor != null) {
              editor.stopCellEditing();
            } else {
              doCancelAction();
            }
          }
        });

    JPanel listPanel =
        ToolbarDecorator.createDecorator(myTable)
            .disableAddAction()
            .disableRemoveAction()
            .createPanel();
    add(listPanel, BorderLayout.CENTER);

    if (getVariableData().length > 1) {
      myTable.getSelectionModel().setSelectionInterval(0, 0);
    }
  }