Make new frame selected
authoramwaterhouse <Andrew Waterhouse>
Wed, 14 Sep 2005 15:42:45 +0000 (15:42 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 14 Sep 2005 15:42:45 +0000 (15:42 +0000)
src/jalview/gui/Desktop.java

index 97c6a20..700b16f 100755 (executable)
@@ -119,6 +119,14 @@ public class Desktop extends jalview.jbgui.GDesktop
         addInternalFrame(frame, "", 750, 160, false);
 
         discoverer=new jalview.ws.Discoverer(); // Only gets started if gui is displayed.
+
+        this.addKeyListener(new KeyAdapter()
+            {
+              public void keyPressed(KeyEvent k)
+              {
+                System.out.println(k);
+              }
+            });
     }
 
     /**
@@ -178,10 +186,6 @@ public class Desktop extends jalview.jbgui.GDesktop
          frame.setLocation(xOffset * openFrameCount, yOffset * ((openFrameCount-1)%10)+yOffset);
        }
 
-       desktop.add(frame);
-       frame.toFront();
-
-
         final JMenuItem menuItem = new JMenuItem(title);
         frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
             {
@@ -211,6 +215,13 @@ public class Desktop extends jalview.jbgui.GDesktop
             });
 
         windowMenu.add(menuItem);
+
+        desktop.add(frame);
+        frame.toFront();
+        try{
+          frame.setSelected(true);
+        }catch(java.beans.PropertyVetoException ve)
+        {}
     }
 
     /**