List of utility methods to do JFrame
void | smartSetBounds(JFrame frame)Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int width = 500; int height = 500; if (screenSize.height <= 600) { height = (int) (screenSize.height * .95); } else if (screenSize.height <= 1000) { height = (int) (screenSize.height * .90); } else if (screenSize.height <= 1200) { ... |
void | staggerOpenedFrames(List stagger Opened Frames JFrame previous = null; if (frames != null && frames.size() > 1) { for (JFrame frame : frames) { if (frame == null) { continue; if (previous != null) { Point pt = previous.getLocation(); ... |
void | storePrefsFrame(Preferences node, JFrame frame) Stores a JFrame size, location and state to the given Preferences node. storePrefsComponent(node, frame); node.putInt(PREFK_STATE, frame.getExtendedState()); |
void | tellUserToChoose(JFrame jFrame) tell User To Choose JOptionPane.showMessageDialog(jFrame, "Please choose a game!");
|
void | terminarPrograma(JFrame f) terminar Programa f.setVisible(false); f.dispose(); System.exit(0); |
void | toFront(final JFrame window) Bring a window to the front WindowFocusListener listener = new WindowFocusListener() { public void windowGainedFocus(WindowEvent e) { window.setAlwaysOnTop(true); public void windowLostFocus(WindowEvent e) { window.setAlwaysOnTop(false); window.removeWindowFocusListener(this); }; window.addWindowFocusListener(listener); window.toFront(); SwingUtilities.invokeLater(new Runnable() { public void run() { window.requestFocus(); }); |
void | toFront(JFrame frame) to Front if (frame.getExtendedState() >= Frame.MAXIMIZED_BOTH) { frame.setExtendedState(Frame.MAXIMIZED_BOTH); } else if (frame.getExtendedState() > Frame.NORMAL) { frame.setExtendedState(Frame.NORMAL); frame.setVisible(true); |
void | toFrontHack(JFrame theParent, JFrame theFrame) Moves a frame in front of another frame if (theFrame.getState() == Frame.ICONIFIED) { theFrame.setState(Frame.NORMAL); } else { Point origPos = theFrame.getLocation(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); theFrame.setLocation(screenSize.width + theParent.getWidth(), screenSize.height + theParent.getHeight()); theFrame.setState(Frame.ICONIFIED); ... |
void | toggleFrame(JFrame frame) toggle Frame if (frame == null) { return; frame.setVisible(!frame.isVisible()); |
void | toggleOsXFullScreen(JFrame frame) toggle Os X Full Screen try { Class<?> app = Class.forName("com.apple.eawt.Application"); Method m = app.getDeclaredMethod("getApplication", new Class[0]); Object application = m.invoke(null, new Object[0]); m = app.getDeclaredMethod("requestToggleFullScreen", Window.class); m.invoke(application, frame); } catch (Exception ex) { |