for (JInternalFrame frame : windows) { if (frame.getTitle().equals("Waiting for players")) { frame.toFront(); frame.setVisible(true); try {
public void toFront() { if ( frame != null ) frame.toFront(); else if ( iframe != null ) iframe.toFront(); }
/** * Brings the given {@code JInternalFrame} to the front. * * @param internalFrame the target {@code JInternalFrame}. */ @RunsInEDT public void moveToFront(final @Nonnull JInternalFrame internalFrame) { execute(() -> // it seems that moving to front always works, regardless if the internal frame is invisible and/or // disabled. internalFrame.toFront()); }
public void toFront() { //if( lala ) { // System.out.println( "toFront" ); // new Exception().printStackTrace(); //} // if( w != null ) { w.toFront(); } else if( jif != null ) { jif.toFront(); try { jif.setSelected( true ); } catch( PropertyVetoException e ) { /* ignored */ } } else { throw new IllegalStateException(); } }
/** * Adds the given {@link JInternalFrame} to the given {@link JDesktopPane} and bring it to the * front. * * @param desktopPane * the desktop pane * @param internalFrame * the internal frame */ public static void addJInternalFrame(final JDesktopPane desktopPane, final JInternalFrame internalFrame) { desktopPane.add(internalFrame); internalFrame.setVisible(true); internalFrame.toFront(); }
@ScriptFunction(jsDoc = TO_FRONT_JSDOC) public void toFront() { if (surface != null) { if (surface instanceof JInternalFrame) { try { ((JInternalFrame) surface).setIcon(false); } catch (Exception e) { } ((JInternalFrame) surface).toFront(); } else if (surface instanceof JFrame) { ((JFrame) surface).toFront(); } } } private static final String GET_MINIMIZED_JSDOC = ""
/** * Workaround for bug: can't re-show internal frames. See bug parade 4138031. */ public static void show(JInternalFrame internalFrame, JDesktopPane desktopPane) throws PropertyVetoException { if (!desktopPane.isAncestorOf(internalFrame)) desktopPane.add(internalFrame); internalFrame.setClosed(false); internalFrame.setVisible(true); internalFrame.toFront(); }
/** * Description of the Method * * @param e Description of Parameter */ public void mouseDragged(MouseEvent e) { try { // do not resize the frame if it is shaded JComponent pane = getNorthPane(); if (e.getSource()==frame && pane instanceof SkinTitlePane && ((SkinTitlePane) pane).getWindow().isShaded()) { return; } super.mouseDragged(e); } catch (NullPointerException ex) { // the nullpointerexception may be thrown by bug id 4383371 // if parentBounds is not set // sending the frame back and front should fix the problem as an Ancestor propertychangeevent // will be sent // this bug has been fixed in JDK1.3 // http://developer.java.sun.com/developer/bugParade/bugs/4383371.html ((JInternalFrame) e.getSource()).toBack(); ((JInternalFrame) e.getSource()).toFront(); } } }
/** * Adds command line window to main frame. * * @param desktop * OVTK2Desktop to host command line */ private void initCommandLine(OVTK2Desktop desktop) { if (console == null || console.isClosed()) { console = new RegisteredJInternalFrame(Config.language.getProperty("Menu.Tools.Console"), "Tools", Config.language.getProperty("Menu.Tools.Console"), true, true, true, true); console.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE); console.setSize(600, 100); try { OutputPrinter c = OVTKScriptingInitialiser.getCommandLine(); JScrollPane scrollingArea = new JScrollPane((Component) c); scrollingArea.setMinimumSize(new Dimension(0, 35)); console.add(scrollingArea); } catch (RuntimeException e) { ErrorDialog.show(e); } desktop.display(console, Position.centered); console.setVisible(true); } else { console.setVisible(true); console.toFront(); } }
/** To be useful here, a MailComposeBean has to be inside * its own little JInternalFrame. */ public MailComposeBean newSend() { // Make the JInternalFrame wrapper JInternalFrame jf = new JInternalFrame(); // Bake the actual Bean MailComposeBean newBean = new MailComposeBean(this, "Compose", 400, 250); // Arrange them on the diagonal. jf.setLocation(nx+=10, ny+=10); // Make the new Bean be the contents of the JInternalFrame jf.setContentPane(newBean); jf.pack(); jf.toFront(); // Add the JInternalFrame to the JDesktopPane dtPane.add(jf); return newBean; }
Administrator.getDesktop().add(viewFrame); viewFrame.setVisible(true); viewFrame.toFront();
private void bringToFront(Component existing) { existing.setVisible(true); existing.show(); if (existing instanceof Frame) { Frame frame = (Frame) existing; frame.toFront(); return; } if (existing instanceof JInternalFrame) { JInternalFrame frame = (JInternalFrame) existing; frame.toFront(); return; } if (existing instanceof JPanel) { JPanel frame = (JPanel) existing; BoxPanelSwitchableView bpsv = Utility.getBoxPanelTabPane(); if (bpsv.containsComponent(frame)) { bpsv.setSelectedComponent(frame); return; } bpsv.addComponent(frame.getName(), frame, DisplayType.PANEL); return; } Debuggable.notImplemented(); }
/** * Adds a given JInternalFrame to the desktop and centers it. * * @param internal * JInternalFrame to be displayed centered */ protected void displayCentered(JInternalFrame internal) { // do the location calculation Rectangle visible = this.getDesktopPane().getVisibleRect(); Dimension size = internal.getSize(); internal.setLocation((visible.width / 2) - (size.width / 2), (visible.height / 2) - (size.height / 2)); // add to desktop and show this.getDesktopPane().add(internal); internal.setVisible(true); internal.toFront(); }
@Override public void start(File file) { this.file = file; OVTK2Desktop desktop = OVTK2Desktop.getInstance(); JOptionPane .showInternalMessageDialog( desktop.getDesktopPane(), "To export appearance of the graph, please make sure you saved appearance first.", "Info", JOptionPane.INFORMATION_MESSAGE); // add GUI to desktop JDesktopPane pane = desktop.getDesktopPane(); initGUI(); pane.add(gui); gui.setVisible(true); gui.toFront(); }
public void selectNextWindow() { JDesktopPane desktop = OVTK2Desktop.getInstance().getDesktopPane(); JInternalFrame[] frames = desktop.getAllFrames(); for (int i = 0; i < frames.length; i++) { if (frames[i].isSelected()) { /* * find next frame that isn't an icon * and can be selected */ try { int next = i + 1; // check just in case if (next > i) return; while (next != i && frames[next].isIcon()) next++; if (next == i) return; // all other frames are icons or veto selection frames[next].setSelected(true); frames[next].toFront(); return; } catch (PropertyVetoException e) { } } } }
@ScriptFunction(jsDoc = MAXIMIZE_JSDOC) public void maximize() { if (surface != null) { if (surface instanceof JFrame) { ((JFrame) surface).setExtendedState(JFrame.MAXIMIZED_BOTH); } else if (surface instanceof JInternalFrame) { JInternalFrame aFrame = (JInternalFrame) surface; try { if (aFrame.isIcon()) { aFrame.setIcon(false); } if (!aFrame.isMaximum() && aFrame.isMaximizable()) { aFrame.setMaximum(true); aFrame.toFront(); } } catch (Exception e) { } } } } private static final String RESTORE_JSDOC = ""
@ScriptFunction(jsDoc = RESTORE_JSDOC) public void restore() { if (surface != null) { if (surface instanceof JInternalFrame) { JInternalFrame aFrame = (JInternalFrame) surface; try { if (aFrame.isMaximum()) { aFrame.setMaximum(false); } if (aFrame.isIcon()) { aFrame.setIcon(false); } } catch (Exception e) { } aFrame.toFront(); } else if (surface instanceof JFrame) { ((JFrame) surface).setExtendedState(JFrame.NORMAL); ((JFrame) surface).toFront(); } } }
} else if (rpContainer instanceof JInternalFrame) { JInternalFrame frame = (JInternalFrame) rpContainer; frame.toFront(); try { frame.setSelected(true);
/** * Creates and shows a new internal frame for the given image. */ private void addImage(final RenderedImage image, final String title) { final JInternalFrame internal = new JInternalFrame(title, true, true); internal.add(new ImagePanel(image)); internal.pack(); internal.show(); desktop.add(internal); if (location > min(desktop.getWidth() - internal.getWidth(), desktop.getHeight() - internal.getHeight())) { location = 0; } internal.setLocation(location, location); location += 30; internal.toFront(); }
/** * Creates and shows a new internal frame for the given image. */ final void addImage(final RenderedImage image, final String title) { final JInternalFrame internal = new JInternalFrame(title, true, true); internal.add(new ImagePanel(image)); internal.pack(); internal.show(); desktop.add(internal); if (location > min(desktop.getWidth() - internal.getWidth(), desktop.getHeight() - internal.getHeight())) { location = 0; } internal.setLocation(location, location); location += 30; internal.toFront(); }