import com.tigervnc.rfb.*;
class ServerDialog extends Dialog implements
- ActionListener,
- ItemListener
+ ActionListener
{
@SuppressWarnings({"unchecked","rawtypes"})
server.setEditable(true);
editor = server.getEditor();
+ editor.getEditorComponent().addKeyListener(new KeyListener() {
+ public void keyTyped(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) {}
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+ server.insertItemAt(editor.getItem(), 0);
+ server.setSelectedIndex(0);
+ commit();
+ }
+ }
+ });
JPanel topPanel = new JPanel(new GridBagLayout());
pack();
}
- public void itemStateChanged(ItemEvent e) {
- return;
- }
-
@SuppressWarnings({"unchecked","rawtypes"})
public void actionPerformed(ActionEvent e) {
Object s = e.getSource();
if (s instanceof JButton && (JButton)s == okButton) {
commit();
- endDialog();
} else if (s instanceof JButton && (JButton)s == cancelButton) {
if (VncViewer.nViewers == 1)
cc.viewer.exit(1);
if (e.getActionCommand().equals("comboBoxEdited")) {
server.insertItemAt(editor.getItem(), 0);
server.setSelectedIndex(0);
- commit();
- endDialog();
}
}
}
}
UserPreferences.set("ServerDialog", "history", sb.toString());
UserPreferences.save("ServerDialog");
+ endDialog();
}
- public void endDialog() {
- super.endDialog();
- }
-
CConn cc;
@SuppressWarnings("rawtypes")
JComboBox server;