summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorBrian Hinz <bphinz@users.sourceforge.net>2013-02-22 19:47:13 +0000
committerBrian Hinz <bphinz@users.sourceforge.net>2013-02-22 19:47:13 +0000
commitfaad79dd78a348a092141a633277b3b6025f82ee (patch)
treea8a6da3e63db1bb76843a500e8c1c007e22542d0 /java
parent0bc5b5e42fbea7ed80f8492b11bd700ae55d6baf (diff)
downloadtigervnc-faad79dd78a348a092141a633277b3b6025f82ee.tar.gz
tigervnc-faad79dd78a348a092141a633277b3b6025f82ee.zip
comboBoxEdited events are fired if the content of the JComboBox is edited and then the comboBox is de-selected. This causes the connection to be initiated inadvertently sometimes (like when the About... button was pressed. Removed the ItemListener since it didn't serve any purpose, and also deleted the definition of endDialog() since it was the same as the inherited function anyway.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5050 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'java')
-rw-r--r--java/com/tigervnc/vncviewer/ServerDialog.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/java/com/tigervnc/vncviewer/ServerDialog.java b/java/com/tigervnc/vncviewer/ServerDialog.java
index a1345850..a1a05602 100644
--- a/java/com/tigervnc/vncviewer/ServerDialog.java
+++ b/java/com/tigervnc/vncviewer/ServerDialog.java
@@ -29,8 +29,7 @@ import java.util.*;
import com.tigervnc.rfb.*;
class ServerDialog extends Dialog implements
- ActionListener,
- ItemListener
+ ActionListener
{
@SuppressWarnings({"unchecked","rawtypes"})
@@ -77,6 +76,17 @@ class ServerDialog extends Dialog implements
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());
@@ -117,16 +127,11 @@ class ServerDialog extends Dialog implements
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);
@@ -140,8 +145,6 @@ class ServerDialog extends Dialog implements
if (e.getActionCommand().equals("comboBoxEdited")) {
server.insertItemAt(editor.getItem(), 0);
server.setSelectedIndex(0);
- commit();
- endDialog();
}
}
}
@@ -172,12 +175,9 @@ class ServerDialog extends Dialog implements
}
UserPreferences.set("ServerDialog", "history", sb.toString());
UserPreferences.save("ServerDialog");
+ endDialog();
}
- public void endDialog() {
- super.endDialog();
- }
-
CConn cc;
@SuppressWarnings("rawtypes")
JComboBox server;