Inheritance diagram for PropertyDialog::

Public Methods | |
| PropertyDialog (String name) | |
| PropertyDialog (JFrame f, String name) | |
| abstract void | onOk () |
| abstract String | getText () |
| void | addPair (String name, JComponent c) |
| void | focusGained (FocusEvent e) |
| void | focusLost (FocusEvent e) |
| void | show () |
| void | actionPerformed (ActionEvent e) |
Static Public Attributes | |
| JFrame | frame = new JFrame() |
|
|
00023 {
00024 this(frame, name);
00025 }
|
|
||||||||||||
|
00028 {
00029 super(f, name, true);
00030 //setSize(400, 200);
00031 setBackground(Color.lightGray);
00032
00033 // ENTER is the default button
00034 //KeyStroke enterKey = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
00035 //Keymap kMap = (new JTextField()).getKeymap();
00036 //kMap.removeKeyStrokeBinding(enterKey);
00037
00038 //ESC closes the dialog
00039 getRootPane().registerKeyboardAction(this,
00040 KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
00041 JComponent.WHEN_IN_FOCUSED_WINDOW);
00042
00043 JPanel p = new JPanel(new FlowLayout());
00044 JPanel pairPanel = new JPanel(new BorderLayout());
00045 _labelPanel = new JPanel(new GridLayout(0, 1));
00046 _fieldPanel = new JPanel(new GridLayout(0, 1));
00047 JPanel butPanel = new JPanel(new FlowLayout());
00048 pairPanel.add(_labelPanel, BorderLayout.CENTER);
00049 pairPanel.add(_fieldPanel, BorderLayout.EAST);
00050 p.add(pairPanel);
00051
00052 _okButton = new JButton(" Ok ");
00053 _okButton.addActionListener(this);
00054 butPanel.add(_okButton);
00055 //getRootPane().setDefaultButton(_okButton);
00056
00057 _cancelButton = new JButton("Cancel");
00058 _cancelButton.addActionListener(this);
00059 butPanel.add(_cancelButton);
00060
00061 JPanel main = new JPanel(new BorderLayout());
00062 main.add(p, BorderLayout.CENTER);
00063 main.add(butPanel, BorderLayout.SOUTH);
00064
00065 getContentPane().add(main);
00066 }
|
|
|
Reimplemented in BpoProperties, LoadProperties, OutProperties, TextProp, UpoProperties, VideoLoadProp, and ViewProperties. |
|
|
Reimplemented in BpoProperties, LoadProperties, OutProperties, UpoProperties, VideoLoadProp, and ViewProperties. |
|
||||||||||||
|
00074 {
00075 if(c == null) c = new JLabel("");
00076 _labelPanel.add(new Label(name));
00077 _fieldPanel.add(c);
00078 c.addFocusListener(this);
00079
00080 if(c instanceof JTextField) {
00081 ((JTextField)c).setActionCommand(_okButton.getActionCommand());
00082 ((JTextField)c).addActionListener(this);
00083 }
00084 }
|
|
|
00087 {
00088 //System.out.println("Focus gained "+ e.getComponent());
00089 if(e.getComponent() instanceof JTextComponent) {
00090 JTextComponent comp = (JTextComponent)e.getComponent();
00091 if(comp.isEditable()) comp.selectAll();
00092 }
00093 }
|
|
|
00096 {
00097 //System.out.println("Focus lost"+ e.getComponent());
00098 if(e.getComponent() instanceof JTextComponent) {
00099 JTextComponent comp = (JTextComponent)e.getComponent();
00100 comp.select(0,0);
00101 }
00102 }
|
|
|
Reimplemented in BpoProperties, OutProperties, UpoProperties, and ViewProperties.
00105 {
00106 pack();
00107 setLocationRelativeTo(null);
00108 super.show();
00109 }
|
|
|
00112 {
00113 if(e.getActionCommand() == _okButton.getActionCommand())
00114 onOk();
00115 hide();
00116 }
|
|
|
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001