List of usage examples for javax.swing JTextField addActionListener
public synchronized void addActionListener(ActionListener l)
From source file:org.forester.archaeopteryx.ControlPanel.java
void addJTextField(final JTextField tf, final JPanel p) { if (!_configuration.isUseNativeUI()) { tf.setForeground(jcb_text_color); // Set search field text color ControlPanel.background_color ); tf.setFont(ControlPanel.jcb_font); }/*from w ww . ja va 2 s . c om*/ p.add(tf); tf.addActionListener(this); }
From source file:net.sf.jabref.gui.openoffice.OpenOfficePanel.java
private void showConnectDialog() { dialogOkPressed = false;/* w ww. j a v a 2 s . c om*/ final JDialog cDiag = new JDialog(frame, Localization.lang("Set connection parameters"), true); final JTextField ooPath = new JTextField(30); JButton browseOOPath = new JButton(Localization.lang("Browse")); ooPath.setText(preferences.getOOPath()); browseOOPath.addActionListener(BrowseAction.buildForDir(ooPath)); final JTextField ooExec = new JTextField(30); JButton browseOOExec = new JButton(Localization.lang("Browse")); ooExec.setText(preferences.getExecutablePath()); browseOOExec.addActionListener(BrowseAction.buildForFile(ooExec)); final JTextField ooJars = new JTextField(30); JButton browseOOJars = new JButton(Localization.lang("Browse")); browseOOJars.addActionListener(BrowseAction.buildForDir(ooJars)); ooJars.setText(preferences.getJarsPath()); FormBuilder builder = FormBuilder.create() .layout(new FormLayout("left:pref, 4dlu, fill:pref:grow, 4dlu, fill:pref", "pref")); if (OS.WINDOWS || OS.OS_X) { builder.add(Localization.lang("Path to OpenOffice/LibreOffice directory")).xy(1, 1); builder.add(ooPath).xy(3, 1); builder.add(browseOOPath).xy(5, 1); } else { builder.add(Localization.lang("Path to OpenOffice/LibreOffice executable")).xy(1, 1); builder.add(ooExec).xy(3, 1); builder.add(browseOOExec).xy(5, 1); builder.appendColumns("4dlu, pref"); builder.add(Localization.lang("Path to OpenOffice/LibreOffice library dir")).xy(1, 3); builder.add(ooJars).xy(3, 3); builder.add(browseOOJars).xy(5, 3); } builder.padding("5dlu, 5dlu, 5dlu, 5dlu"); ButtonBarBuilder bb = new ButtonBarBuilder(); JButton ok = new JButton(Localization.lang("OK")); JButton cancel = new JButton(Localization.lang("Cancel")); ActionListener tfListener = e -> { preferences.updateConnectionParams(ooPath.getText(), ooExec.getText(), ooJars.getText()); cDiag.dispose(); }; ooPath.addActionListener(tfListener); ooExec.addActionListener(tfListener); ooJars.addActionListener(tfListener); ok.addActionListener(e -> { preferences.updateConnectionParams(ooPath.getText(), ooExec.getText(), ooJars.getText()); dialogOkPressed = true; cDiag.dispose(); }); cancel.addActionListener(e -> cDiag.dispose()); bb.addGlue(); bb.addRelatedGap(); bb.addButton(ok); bb.addButton(cancel); bb.addGlue(); bb.padding("5dlu, 5dlu, 5dlu, 5dlu"); cDiag.getContentPane().add(builder.getPanel(), BorderLayout.CENTER); cDiag.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH); cDiag.pack(); cDiag.setLocationRelativeTo(frame); cDiag.setVisible(true); }
From source file:net.sf.jabref.openoffice.OpenOfficePanel.java
private void showConnectDialog() { dialogOkPressed = false;/* ww w.j av a2 s . c o m*/ final JDialog cDiag = new JDialog(frame, Localization.lang("Set connection parameters"), true); final JTextField ooPath = new JTextField(30); JButton browseOOPath = new JButton(Localization.lang("Browse")); ooPath.setText(Globals.prefs.get(JabRefPreferences.OO_PATH)); browseOOPath.addActionListener(BrowseAction.buildForDir(ooPath)); final JTextField ooExec = new JTextField(30); JButton browseOOExec = new JButton(Localization.lang("Browse")); ooExec.setText(Globals.prefs.get(JabRefPreferences.OO_EXECUTABLE_PATH)); browseOOExec.addActionListener(BrowseAction.buildForFile(ooExec)); final JTextField ooJars = new JTextField(30); JButton browseOOJars = new JButton(Localization.lang("Browse")); browseOOJars.addActionListener(BrowseAction.buildForDir(ooJars)); ooJars.setText(Globals.prefs.get(JabRefPreferences.OO_JARS_PATH)); DefaultFormBuilder builder = new DefaultFormBuilder( new FormLayout("left:pref, 4dlu, fill:pref:grow, 4dlu, fill:pref", "")); if (OS.WINDOWS || OS.OS_X) { builder.append(Localization.lang("Path to OpenOffice directory")); builder.append(ooPath); builder.append(browseOOPath); builder.nextLine(); } else { builder.append(Localization.lang("Path to OpenOffice executable")); builder.append(ooExec); builder.append(browseOOExec); builder.nextLine(); builder.append(Localization.lang("Path to OpenOffice library dir")); builder.append(ooJars); builder.append(browseOOJars); builder.nextLine(); } ButtonBarBuilder bb = new ButtonBarBuilder(); JButton ok = new JButton(Localization.lang("OK")); JButton cancel = new JButton(Localization.lang("Cancel")); ActionListener tfListener = (e -> { updateConnectionParams(ooPath.getText(), ooExec.getText(), ooJars.getText()); cDiag.dispose(); }); ooPath.addActionListener(tfListener); ooExec.addActionListener(tfListener); ooJars.addActionListener(tfListener); ok.addActionListener(e -> { updateConnectionParams(ooPath.getText(), ooExec.getText(), ooJars.getText()); dialogOkPressed = true; cDiag.dispose(); }); cancel.addActionListener(e -> cDiag.dispose()); bb.addGlue(); bb.addRelatedGap(); bb.addButton(ok); bb.addButton(cancel); bb.addGlue(); builder.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); cDiag.getContentPane().add(builder.getPanel(), BorderLayout.CENTER); cDiag.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH); cDiag.pack(); cDiag.setLocationRelativeTo(frame); cDiag.setVisible(true); }
From source file:edu.umich.robot.GuiApplication.java
public void createSuperdroidRobotDialog() { final Pose pose = new Pose(); FormLayout layout = new FormLayout("right:pref, 4dlu, 30dlu, 4dlu, right:pref, 4dlu, 30dlu", "pref, 2dlu, pref, 2dlu, pref"); layout.setRowGroups(new int[][] { { 1, 3 } }); final JDialog dialog = new JDialog(frame, "Create Superdroid Robot", true); dialog.setLayout(layout);//from www . ja v a 2s .c o m final JTextField name = new JTextField(); final JTextField x = new JTextField(Double.toString((pose.getX()))); final JTextField y = new JTextField(Double.toString((pose.getY()))); final JButton cancel = new JButton("Cancel"); final JButton ok = new JButton("OK"); CellConstraints cc = new CellConstraints(); dialog.add(new JLabel("Name"), cc.xy(1, 1)); dialog.add(name, cc.xyw(3, 1, 5)); dialog.add(new JLabel("x"), cc.xy(1, 3)); dialog.add(x, cc.xy(3, 3)); dialog.add(new JLabel("y"), cc.xy(5, 3)); dialog.add(y, cc.xy(7, 3)); dialog.add(cancel, cc.xyw(1, 5, 3)); dialog.add(ok, cc.xyw(5, 5, 3)); x.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { try { pose.setX(Double.parseDouble(x.getText())); } catch (NumberFormatException ex) { x.setText(Double.toString(pose.getX())); } } }); y.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { try { pose.setY(Double.parseDouble(y.getText())); } catch (NumberFormatException ex) { y.setText(Double.toString(pose.getX())); } } }); final ActionListener okListener = new ActionListener() { public void actionPerformed(ActionEvent e) { String robotName = name.getText().trim(); if (robotName.isEmpty()) { logger.error("Create Superdroid: robot name empty"); return; } for (char c : robotName.toCharArray()) if (!Character.isDigit(c) && !Character.isLetter(c)) { logger.error("Create Superdroid: illegal robot name"); return; } controller.createSuperdroidRobot(robotName, pose, true); controller.createSimSuperdroid(robotName); dialog.dispose(); } }; name.addActionListener(okListener); x.addActionListener(okListener); y.addActionListener(okListener); ok.addActionListener(okListener); ActionListener cancelAction = new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); } }; cancel.addActionListener(cancelAction); dialog.getRootPane().registerKeyboardAction(cancelAction, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); dialog.setLocationRelativeTo(frame); dialog.pack(); dialog.setVisible(true); }
From source file:edu.umich.robot.GuiApplication.java
/** * <p>/*w ww . j a v a 2 s. c om*/ * Pops up a window to create a new splinter robot to add to the simulation. */ public void createSplinterRobotDialog() { final Pose pose = new Pose(); FormLayout layout = new FormLayout("right:pref, 4dlu, 30dlu, 4dlu, right:pref, 4dlu, 30dlu", "pref, 2dlu, pref, 2dlu, pref"); layout.setRowGroups(new int[][] { { 1, 3 } }); final JDialog dialog = new JDialog(frame, "Create Splinter Robot", true); dialog.setLayout(layout); final JTextField name = new JTextField(); final JTextField x = new JTextField(Double.toString((pose.getX()))); final JTextField y = new JTextField(Double.toString((pose.getY()))); final JButton cancel = new JButton("Cancel"); final JButton ok = new JButton("OK"); CellConstraints cc = new CellConstraints(); dialog.add(new JLabel("Name"), cc.xy(1, 1)); dialog.add(name, cc.xyw(3, 1, 5)); dialog.add(new JLabel("x"), cc.xy(1, 3)); dialog.add(x, cc.xy(3, 3)); dialog.add(new JLabel("y"), cc.xy(5, 3)); dialog.add(y, cc.xy(7, 3)); dialog.add(cancel, cc.xyw(1, 5, 3)); dialog.add(ok, cc.xyw(5, 5, 3)); x.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { try { pose.setX(Double.parseDouble(x.getText())); } catch (NumberFormatException ex) { x.setText(Double.toString(pose.getX())); } } }); y.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { try { pose.setY(Double.parseDouble(y.getText())); } catch (NumberFormatException ex) { y.setText(Double.toString(pose.getX())); } } }); final ActionListener okListener = new ActionListener() { public void actionPerformed(ActionEvent e) { String robotName = name.getText().trim(); if (robotName.isEmpty()) { logger.error("Create splinter: robot name empty"); return; } for (char c : robotName.toCharArray()) if (!Character.isDigit(c) && !Character.isLetter(c)) { logger.error("Create splinter: illegal robot name"); return; } controller.createSplinterRobot(robotName, pose, true); controller.createSimSplinter(robotName); controller.createSimLaser(robotName); dialog.dispose(); } }; name.addActionListener(okListener); x.addActionListener(okListener); y.addActionListener(okListener); ok.addActionListener(okListener); ActionListener cancelAction = new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); } }; cancel.addActionListener(cancelAction); dialog.getRootPane().registerKeyboardAction(cancelAction, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); dialog.setLocationRelativeTo(frame); dialog.pack(); dialog.setVisible(true); }
From source file:edu.umich.robot.GuiApplication.java
public void connectSuperdroidRobotDialog() { final int defaultPort = 3192; FormLayout layout = new FormLayout("right:pref, 4dlu, 35dlu, 4dlu, 35dlu", "pref, 2dlu, pref, 2dlu, pref, 2dlu, pref"); final JDialog dialog = new JDialog(frame, "Connect to Superdroid", true); dialog.setLayout(layout);/*from www . j a va 2 s . com*/ final JTextField namefield = new JTextField("charlie"); final JTextField hostfield = new JTextField("192.168.1.165"); final JTextField portfield = new JTextField(Integer.toString(defaultPort)); final JButton cancel = new JButton("Cancel"); final JButton ok = new JButton("OK"); CellConstraints cc = new CellConstraints(); dialog.add(new JLabel("Name"), cc.xy(1, 1)); dialog.add(namefield, cc.xyw(3, 1, 3)); dialog.add(new JLabel("Host"), cc.xy(1, 3)); dialog.add(hostfield, cc.xyw(3, 3, 3)); dialog.add(new JLabel("Port"), cc.xy(1, 5)); dialog.add(portfield, cc.xyw(3, 5, 3)); dialog.add(cancel, cc.xy(3, 7)); dialog.add(ok, cc.xy(5, 7)); portfield.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { int p = defaultPort; try { p = Integer.parseInt(portfield.getText()); if (p < 1) p = 1; if (p > 65535) p = 65535; } catch (NumberFormatException ex) { } portfield.setText(Integer.toString(p)); } }); final ActionListener okListener = new ActionListener() { public void actionPerformed(ActionEvent e) { String robotName = namefield.getText().trim(); if (robotName.isEmpty()) { logger.error("Connect Superdroid: robot name empty"); return; } for (char c : robotName.toCharArray()) { if (!Character.isDigit(c) && !Character.isLetter(c)) { logger.error("Create Superdroid: illegal robot name"); return; } } try { controller.createRealSuperdroid(robotName, hostfield.getText(), Integer.valueOf(portfield.getText())); } catch (UnknownHostException ex) { ex.printStackTrace(); logger.error("Connect Superdroid: " + ex); } catch (SocketException ex) { ex.printStackTrace(); logger.error("Connect Superdroid: " + ex); } dialog.dispose(); } }; namefield.addActionListener(okListener); hostfield.addActionListener(okListener); portfield.addActionListener(okListener); ok.addActionListener(okListener); ActionListener cancelAction = new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); } }; cancel.addActionListener(cancelAction); dialog.getRootPane().registerKeyboardAction(cancelAction, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); dialog.setLocationRelativeTo(frame); dialog.pack(); dialog.setVisible(true); }
From source file:nl.detoren.ijsco.ui.Mainscreen.java
public JPanel createDeelnemersPanel() { JPanel panel = new JPanel(false); panel.setBackground(Color.BLACK); //panel.setLayout(new GridLayout(1, 0)); panel.setLayout(new BorderLayout()); JPanel innerPanel = new JPanel(); JLabel lbAanwezig = new JLabel("Deelnemers: "); innerPanel.add(lbAanwezig, BorderLayout.NORTH); tfAanwezig = new JLabel(Integer.toString(status.deelnemers.aantalAanwezig()), 10); innerPanel.add(tfAanwezig, BorderLayout.NORTH); //innerPanel.setLayout(new GridLayout(1, 0)); innerPanel.add(new JLabel("Naam:"), BorderLayout.NORTH); JTextField deelnemer = new JTextField(15); ArrayList<String> words = new ArrayList<>(); if (status.OSBOSpelers != null) { for (Speler s : status.OSBOSpelers.values()) { words.add(s.getNaam().trim()); words.add(Integer.toString(s.getKnsbnummer())); }// w w w .j ava 2 s. c o m } @SuppressWarnings("unused") Suggesties suggesties = new Suggesties(deelnemer, this, words, 2); innerPanel.add(deelnemer, BorderLayout.NORTH); deelnemer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { actieVoegSpelerToe(deelnemer.getText().trim()); deelnemer.setText(""); } }); JButton btVoegToe = new JButton("Voeg toe"); btVoegToe.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { actieVoegSpelerToe(deelnemer.getText().trim()); deelnemer.setText(""); } }); innerPanel.add(btVoegToe); panel.add(innerPanel); // panel_deelnemers.add(new JLabel("Deelnemers IJSCO toernooi")); deelnemersModel = new DeelnemersModel(panel, status.deelnemers); JTable deelnemersTabel = new JTable(deelnemersModel) { private static final long serialVersionUID = -8293073016982337108L; @Override public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component c = super.prepareRenderer(renderer, row, column); DeelnemersModel model = (DeelnemersModel) getModel(); // Tooltip if (c instanceof JComponent) { ((JComponent) c) .setToolTipText(model.getToolTip(convertRowIndexToModel(row), column).toString()); } // Alternate row color if (!isRowSelected(row)) { c.setBackground(row % 2 == 0 ? Color.WHITE : Color.LIGHT_GRAY); } // Highlight overruled entries if (status.deelnemers.get(convertRowIndexToModel(row)).isOverruleNaam() || status.deelnemers.get(convertRowIndexToModel(row)).isOverruleNaam()) { c.setForeground(Color.BLUE); } else { c.setForeground(Color.BLACK); } return c; } }; deelnemersTabel.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent arg0) { status.groepen = null; status.schemas = null; status.schema = null; groepenText.setText(""); schemaModel.setSchemas(null); schemaModel.fireTableDataChanged(); if (status.deelnemers != null && tfAanwezig != null) { tfAanwezig.setText(Integer.toString(status.deelnemers.aantalAanwezig())); } panel.repaint(); } }); deelnemersTabel.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { logger.log(Level.INFO, "MouseEvent on table fired, type : " + e.toString()); logger.log(Level.INFO, "Popup trigger? : " + e.isPopupTrigger()); if (e.isPopupTrigger()) { int row = deelnemersTabel.rowAtPoint(e.getPoint()); JPopupMenu popup = new JPopupMenu(); JMenuItem menuItem = new JMenuItem("Bewerk speler"); menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { logger.log(Level.INFO, "Bewerk Speler : " + deelnemersTabel.convertRowIndexToModel(row)); Speler s = status.deelnemers.get(deelnemersTabel.convertRowIndexToModel(row)); BewerkSpelerDialoog rd = new BewerkSpelerDialoog(new JFrame(), "Bewerk Speler", s, deelnemersModel); rd.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { System.out.println("closing..."); } }); rd.setVisible(true); } }); popup.add(menuItem); menuItem = new JMenuItem("Verwijder Speler"); popup.add(menuItem); menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { logger.log(Level.INFO, "Verwijder Speler : " + deelnemersTabel.convertRowIndexToModel(row)); Speler s = status.deelnemers.get(deelnemersTabel.convertRowIndexToModel(row)); status.deelnemers.remove(s); deelnemersModel.fireTableDataChanged(); } }); popup.show(e.getComponent(), e.getX(), e.getY()); } } }); JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(deelnemersTabel); innerPanel.add(scrollPane, BorderLayout.CENTER); TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(deelnemersModel); deelnemersTabel.setRowSorter(sorter); innerPanel.add(new JLabel("Filter op : ")); JTextField tfFilter = new JTextField(10); tfFilter.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { String text = tfFilter.getText(); logger.log(Level.INFO, "Filter tabel op : " + text); if (text.length() == 0) { sorter.setRowFilter(null); } else { sorter.setRowFilter(RowFilter.regexFilter("(?i)" + text)); } } }); innerPanel.add(tfFilter); JButton btPasToe = new JButton("Apply"); btPasToe.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { String text = tfFilter.getText(); logger.log(Level.INFO, "Filter tabel op : " + text); if (text.length() == 0) { sorter.setRowFilter(null); } else { sorter.setRowFilter(RowFilter.regexFilter("(?i)" + text)); } } }); innerPanel.add(btPasToe); JButton btWis = new JButton("Wis"); btWis.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { tfFilter.setText(""); logger.log(Level.INFO, "Wis filter"); sorter.setRowFilter(null); } }); innerPanel.add(btWis); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(0), 30); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(1), 55); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(2), 170); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(3), 40); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(4), 40); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(5), 30); Utils.fixedComponentSize(scrollPane, 400, 580); return panel; }
From source file:op.care.prescription.DlgOnDemand.java
private void btnSituationActionPerformed(ActionEvent e) { final JidePopup popup = new JidePopup(); popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); final JTextField editor = new JTextField(txtSit.getText(), 30); editor.addActionListener(new ActionListener() { @Override//from w w w . ja v a 2s. co m public void actionPerformed(ActionEvent actionEvent) { saveSituation(editor.getText()); popup.hidePopup(); } }); popup.getContentPane().add(new JScrollPane(editor)); JButton saveButton = new JButton(SYSConst.icon22apply); saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { saveSituation(editor.getText()); popup.hidePopup(); } }); popup.setMovable(false); popup.setOwner(btnAddSit); popup.removeExcludedComponent(btnAddSit); popup.getContentPane().add(saveButton); popup.setDefaultFocusComponent(editor); GUITools.showPopup(popup, SwingConstants.SOUTH_WEST); }
From source file:org.apache.oodt.cas.workflow.gui.perspective.view.impl.DefaultPropView.java
private JPanel getTimeout(final ModelGraph graph, final ViewState state) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.setBorder(new EtchedBorder()); panel.add(new JLabel("Timeout:"), BorderLayout.NORTH); JTextField field = new JTextField(String.valueOf(graph.getModel().getTimeout()), 50); field.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (!graph.getModel().getModelId().equals(e.getActionCommand())) { graph.getModel().setTimeout(Long.valueOf( e.getActionCommand() != null && !e.getActionCommand().equals("") ? e.getActionCommand() : "-1")); DefaultPropView.this.notifyListeners(); DefaultPropView.this.refreshView(state); }/*from ww w. j a v a2 s . c o m*/ } }); panel.add(field, BorderLayout.CENTER); return panel; }
From source file:org.apache.oodt.cas.workflow.gui.perspective.view.impl.DefaultPropView.java
private JPanel getModelIdPanel(final ModelGraph graph, final ViewState state) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.setBorder(new EtchedBorder()); panel.add(new JLabel("ModelId:"), BorderLayout.NORTH); JTextField field = new JTextField(graph.getModel().getModelId(), 50); field.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (!graph.getModel().getModelId().equals(e.getActionCommand())) { GuiUtils.updateGraphModelId(state, graph.getModel().getId(), e.getActionCommand()); DefaultPropView.this.notifyListeners(); DefaultPropView.this.refreshView(state); }/*from w w w. j ava2 s. c om*/ } }); panel.add(field, BorderLayout.CENTER); return panel; }