[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tigervnc-commits
Subject:    [Tigervnc-commits] SF.net SVN: tigervnc:[5050] trunk/java/com/tigervnc/vncviewer/ServerDialog. java
From:       bphinz () users ! sourceforge ! net
Date:       2013-02-22 19:47:13
Message-ID: E1U8yaP-0002jX-Ow () sfp-svn-1 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 5050
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=5050&view=rev
Author:   bphinz
Date:     2013-02-22 19:47:13 +0000 (Fri, 22 Feb 2013)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/java/com/tigervnc/vncviewer/ServerDialog.java

Modified: trunk/java/com/tigervnc/vncviewer/ServerDialog.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/ServerDialog.java	2013-02-21 03:11:14 UTC (rev \
                5049)
+++ trunk/java/com/tigervnc/vncviewer/ServerDialog.java	2013-02-22 19:47:13 UTC (rev \
5050) @@ -29,8 +29,7 @@
 import com.tigervnc.rfb.*;
 
 class ServerDialog extends Dialog implements
-                           ActionListener,
-                           ItemListener
+                           ActionListener
 {
 
   @SuppressWarnings({"unchecked","rawtypes"})
@@ -77,6 +76,17 @@
 
     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 @@
     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 @@
       if (e.getActionCommand().equals("comboBoxEdited")) {
         server.insertItemAt(editor.getItem(), 0);
         server.setSelectedIndex(0);
-        commit();
-        endDialog();
       }
     }
   }
@@ -172,12 +175,9 @@
     }
     UserPreferences.set("ServerDialog", "history", sb.toString());
     UserPreferences.save("ServerDialog");
+    endDialog();
   }
   
-  public void endDialog() {
-    super.endDialog();
-  }
-
   CConn cc;
   @SuppressWarnings("rawtypes")
   JComboBox server;

This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Tigervnc-commits mailing list
Tigervnc-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic