/** Show the window if it is non-null */ public void show() { if (frame != null) { frame.show(); } Component contents = getContents(); if (contents != null) { GuiUtils.showComponentInTabs(contents, true); } }
/** * Make the IdvWindow. Add event handlers for adding new data sources and closing the window. * * @return The window to put the gui in */ public IdvWindow doMakeFrame() { if (frame == null) { JButton newBtn = new JButton("Add New Data Source"); newBtn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { idv.showChooser(); } }); JButton closeBtn = new JButton("Close"); closeBtn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { doClose(); } }); JComponent extra = getButtons(); JComponent buttons; if (extra != null) { buttons = GuiUtils.wrap( GuiUtils.hflow( Misc.newList( /*newBtn,*/ extra, closeBtn), 4, 4)); } else { buttons = GuiUtils.wrap( GuiUtils.hflow( Misc.newList( /*newBtn,*/ closeBtn), 4, 4)); } JPanel contents = GuiUtils.centerBottom(getContents(), buttons); frame = new IdvWindow(getName(), idv, false); frame.getContentPane().add(contents); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { doClose(); } }); frame.pack(); frame.show(); } return frame; }