SplashScreen splash = new SplashScreen(frame, image);
frame.setContentPane(splash);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
- addInternalFrame(frame, "", 750, 160, false);
frame.setLocation((int) ((getWidth() - 750) / 2),
(int) ((getHeight() - 160) / 2));
- discoverer=new jalview.ws.Discoverer(); // Only gets started if gui is displayed.
+
+ addInternalFrame(frame, "", 750, 160, false);
+
+ discoverer=new jalview.ws.Discoverer(); // Only gets started if gui is displayed.
}
/**
* @param w DOCUMENT ME!
* @param h DOCUMENT ME!
*/
- public static void addInternalFrame(final JInternalFrame frame,
+ public static synchronized void addInternalFrame(final JInternalFrame frame,
String title, int w, int h)
{
addInternalFrame(frame, title, w, h, true);
* @param h DOCUMENT ME!
* @param resizable DOCUMENT ME!
*/
- public static void addInternalFrame(final JInternalFrame frame,
+ public static synchronized void addInternalFrame(final JInternalFrame frame,
String title, int w, int h, boolean resizable)
{
frame.setTitle(title);
- frame.setSize(w, h);
-
+ if(frame.getWidth()<1 || frame.getHeight()<1)
+ {
+ frame.setSize(w, h);
+ }
// THIS IS A PUBLIC STATIC METHOD, SO IT MAY BE CALLED EVEN IN
// A HEADLESS STATE WHEN NO DESKTOP EXISTS. MUST RETURN
// IF JALVIEW IS RUNNING HEADLESS
}
- desktop.add(frame);
openFrameCount++;
- try
- {
- frame.setSelected(true);
- }
- catch (java.beans.PropertyVetoException e)
- {
- }
-
+ frame.setVisible(true);
frame.setClosable(true);
frame.setResizable(resizable);
frame.setMaximizable(resizable);
frame.setIconifiable(resizable);
frame.setFrameIcon(null);
- frame.setLocation(xOffset * openFrameCount, yOffset * openFrameCount);
- frame.toFront();
+
+ if (frame.getX()<1 && frame.getY()<1)
+ {
+ 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()
}
catch (java.beans.PropertyVetoException ex)
{
- }
- ;
+ }
}
});
- frame.setVisible(true);
windowMenu.add(menuItem);
}