From: <sh...@us...> - 2006-12-11 16:07:18
|
Revision: 7463 http://svn.sourceforge.net/cdk/?rev=7463&view=rev Author: shk3 Date: 2006-12-11 08:07:02 -0800 (Mon, 11 Dec 2006) Log Message: ----------- this class is no longer needed Removed Paths: ------------- trunk/cdk/src/org/openscience/cdk/applications/jchempaint/dialogs/EnterElementOrGroupDialog.java Deleted: trunk/cdk/src/org/openscience/cdk/applications/jchempaint/dialogs/EnterElementOrGroupDialog.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/applications/jchempaint/dialogs/EnterElementOrGroupDialog.java 2006-12-11 15:42:23 UTC (rev 7462) +++ trunk/cdk/src/org/openscience/cdk/applications/jchempaint/dialogs/EnterElementOrGroupDialog.java 2006-12-11 16:07:02 UTC (rev 7463) @@ -1,111 +0,0 @@ -package org.openscience.cdk.applications.jchempaint.dialogs; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.Frame; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; - -public class EnterElementOrGroupDialog extends JDialog implements ActionListener { - - private static EnterElementOrGroupDialog dialog; - private static String value = ""; - private JComboBox list; - - /** - * Set up and show the dialog. The first Component argument - * determines which frame the dialog depends on; it should be - * a component in the dialog's controlling frame. The second - * Component argument should be null if you want the dialog - * to come up with its left corner in the center of the screen; - * otherwise, it should be the component on top of which the - * dialog should appear. - */ - public static String showDialog(Component frameComp, - Component locationComp, - String labelText, - String title, - String[] possibleValues, - String initialValue, - String longValue) { - Frame frame = JOptionPane.getFrameForComponent(frameComp); - dialog = new EnterElementOrGroupDialog(frame, - locationComp, - labelText, - title, - possibleValues, - initialValue, - longValue); - dialog.setVisible(true); - return value; - } - - private EnterElementOrGroupDialog(Frame frame, - Component locationComp, - String labelText, - String title, - Object[] data, - String initialValue, - String longValue) { - super(frame, title, true); - - //Create and initialize the buttons. - JButton cancelButton = new JButton("Cancel"); - cancelButton.addActionListener(this); - // - final JButton setButton = new JButton("Ok"); - setButton.setActionCommand("Set"); - setButton.addActionListener(this); - getRootPane().setDefaultButton(setButton); - - //main part of the dialog - list = new JComboBox(data); - list.setEditable(true); - JPanel listPane = new JPanel(); - listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS)); - JLabel label = new JLabel(labelText); - label.setLabelFor(list); - listPane.add(label); - listPane.add(Box.createRigidArea(new Dimension(0,5))); - listPane.add(list); - listPane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); - - //Lay out the buttons from left to right. - JPanel buttonPane = new JPanel(); - buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); - buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); - buttonPane.add(Box.createHorizontalGlue()); - buttonPane.add(cancelButton); - buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); - buttonPane.add(setButton); - - //Put everything together, using the content pane's BorderLayout. - Container contentPane = getContentPane(); - contentPane.add(listPane, BorderLayout.CENTER); - contentPane.add(buttonPane, BorderLayout.PAGE_END); - - //Initialize values. - pack(); - setLocationRelativeTo(locationComp); - } - - //Handle clicks on the Set and Cancel buttons. - public void actionPerformed(ActionEvent e) { - if ("Set".equals(e.getActionCommand())) { - EnterElementOrGroupDialog.value = (String)(list.getSelectedItem()); - } - EnterElementOrGroupDialog.dialog.setVisible(false); - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |