final JInternalFrame frame, String title, int w, int h)
{
// 58 classes
- getInstance().addFrame(frame, title, Desktop.FRAME_MAKE_VISIBLE, w, h,
+
+ setFrame(frame, title, w, h);
+
+ // Headless operation has no Desktop instance, only the static class.
+
+ if (getInstance() != null)
+ getInstance().addFrame(frame, Desktop.FRAME_MAKE_VISIBLE,
FRAME_ALLOW_RESIZE, FRAME_SET_MIN_SIZE_300);
}
int w, int h, boolean resizable, boolean ignoreMinSize)
{
// 15 classes
- getInstance().addFrame(frame, title, makeVisible, w, h, resizable,
+ setFrame(frame, title, w, h);
+
+ if (getInstance() != null)
+ getInstance().addFrame(frame, makeVisible, resizable,
ignoreMinSize);
}
public final static boolean FRAME_SET_MIN_SIZE_300 = false;
- private void addFrame(JInternalFrame frame, String title,
- boolean makeVisible, int w, int h, boolean resizable,
- boolean ignoreMinSize)
+ private static void setFrame(JInternalFrame frame, String title,
+ int w, int h)
{
// TODO: allow callers to determine X and Y position of frame (eg. via
// bounds object).
{
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
- // ///////////////////////////////////////////////
- if (Jalview.isHeadlessMode())
- {
- return;
- }
+ }
+
+ private void addFrame(JInternalFrame frame,
+ boolean makeVisible, boolean resizable,
+ boolean ignoreMinSize)
+ {
openFrameCount++;
* add an entry for the new frame in the Window menu
* (and remove it when the frame is closed)
*/
- final JMenuItem menuItem = new JMenuItem(title);
+ final JMenuItem menuItem = new JMenuItem(frame.getTitle());
frame.addInternalFrameListener(new InternalFrameAdapter()
{
@Override