/** * DOCUMENT ME! * * @param e DOCUMENT ME! */ public void actionPerformed(ActionEvent e) { Object _actionObject = e.getSource(); // handle Button events if (_actionObject instanceof JButton) { JButton _btn = (JButton) _actionObject; if (_btn == btnOK) { networkTitle = tfNetworkTitle.getText(); this.dispose(); } else if (_btn == btnCancel) { this.dispose(); } } }
/** * Creates a new EditNetworkTitleDialog object. * * @param parent DOCUMENT ME! * @param modal DOCUMENT ME! * @param pName DOCUMENT ME! */ public EditNetworkTitleDialog(Component parent, boolean modal, String pName) { super((JFrame) parent, modal); initComponents(); tfNetworkTitle.setText(pName); tfNetworkTitle.setSelectionStart(0); tfNetworkTitle.setSelectionEnd(pName.length()); setSize(new java.awt.Dimension(300, 170)); }
btnCancel.addActionListener(this); getContentPane().setLayout(new GridBagLayout()); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Edit Network Title"); jLabel1.setText("Please enter new network title:"); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new Insets(15, 10, 0, 0); getContentPane().add(jLabel1, gridBagConstraints); gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(10, 10, 10, 10); getContentPane().add(tfNetworkTitle, gridBagConstraints); gridBagConstraints.gridy = 2; gridBagConstraints.insets = new Insets(10, 0, 10, 0); getContentPane().add(jPanel1, gridBagConstraints); pack();
cytoscape.dialogs.EditNetworkTitleDialog theDialog = new cytoscape.dialogs.EditNetworkTitleDialog(parent, true, pname); theDialog.setLocationRelativeTo(parent); theDialog.setVisible(true); name = theDialog.getNewNetworkTitle();