List of utility methods to do Window
void | modifyDimensions(Window window) modify Dimensions if (window instanceof JFrame) { if (((JFrame) window).getExtendedState() == JFrame.MAXIMIZED_BOTH) { return; Dimension result = window.getSize(); Dimension maxDimension = Toolkit.getDefaultToolkit().getScreenSize(); if (maxDimension.width < result.width) { ... |
void | openWindow(final JPanel panel) Open a new window displaying a JPanel. final javax.swing.JFrame jf = new javax.swing.JFrame(panel.getName()); jf.setSize(panel.getWidth(), panel.getHeight()); jf.add(panel, BorderLayout.CENTER); jf.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { jf.dispose(); }); ... |
void | putWindowNormalBounds(Window window, Rectangle bounds) Puts Window bounds to client property. if (window instanceof JFrame) { ((JFrame) window).getRootPane().putClientProperty(WINDOW_STATE_NORMAL_BOUNDS, bounds); |
void | removeWindow(Window w) Removes a window from the set (i.e. synchronized (windows) { if (windows.remove(w)) { if (w instanceof Dialog && ((Dialog) w).isModal()) { modalDialogs.remove(w); fireWindowActionPerformed(new ActionEvent(w, Event.ACTION_EVENT, "remove")); |
void | repaintMnemonicsInWindow(Window w) repaint Mnemonics In Window if (w == null || !w.isShowing()) { return; Window[] ownedWindows = w.getOwnedWindows(); for (int i = 0; i < ownedWindows.length; i++) { repaintMnemonicsInWindow(ownedWindows[i]); repaintMnemonicsInContainer(w); ... |
void | setWindowAlpha(Window w, int value) set Window Alpha if (w == null) return; if (w.getPeer() == null) { w.pack(); java.awt.peer.ComponentPeer peer = w.getPeer(); try { invoke(peer, "setAlpha", (float) (value / 255f)); ... |
void | setWindowOpacity(Window window, float opacity) set Window Opacity try { Class clazz = Class.forName("com.sun.awt.AWTUtilities"); Method opacityMethod = clazz.getDeclaredMethod("setWindowOpacity", Window.class, float.class); opacityMethod.invoke(null, window, opacity); } catch (Exception exc) { exc.printStackTrace(); |
void | show(final Container container, final boolean visible, Window appearOnLeftSide) show if (visible) adjustLocation(container, appearOnLeftSide); SwingUtilities.invokeLater(new Runnable() { public void run() { container.setVisible(visible); }); |
void | show(JWindow window) Shows a window. window.setVisible(true); |
void | showLater(final Window win) show Later SwingUtilities.invokeLater(new Runnable() { public void run() { win.setVisible(true); }); |