/** Tries to resize wizard wisely if needed. Keeps "display inertia" so that * wizard is only enlarged, not shrinked, and location is changed only when * wizard window exceeds screen bounds after resize. */ private void resizeWizard(Window parentWindow, Dimension prevSize) { assert SwingUtilities.isEventDispatchThread () : "getComponent() must be called in EQ only."; Dimension curSize = data.getIterator(this).current().getComponent().getPreferredSize(); // only enlarge if needed, don't shrink if ((curSize.width > prevSize.width) || (curSize.height > prevSize.height)) { Rectangle origBounds = parentWindow.getBounds(); int newWidth = Math.max(origBounds.width + (curSize.width - prevSize.width), origBounds.width); int newHeight = Math.max(origBounds.height + (curSize.height - prevSize.height), origBounds.height); Rectangle screenBounds = Utilities.getUsableScreenBounds(); Rectangle newBounds; // don't allow to exceed screen size, center if needed if (((origBounds.x + newWidth) > screenBounds.width) || ((origBounds.y + newHeight) > screenBounds.height)) { newWidth = Math.min(screenBounds.width, newWidth); newHeight = Math.min(screenBounds.height, newHeight); newBounds = Utilities.findCenterBounds(new Dimension(newWidth, newHeight)); } else { newBounds = new Rectangle(origBounds.x, origBounds.y, newWidth, newHeight); } parentWindow.setBounds(newBounds); parentWindow.invalidate(); parentWindow.validate(); parentWindow.repaint(); } }
public void run() { w.repaint(); } });
for (Window window: Window.getWindows()) { if (window.isVisible()) { injectResources(window); window.repaint(); if (window instanceof RootPaneContainer) { ((RootPaneContainer) window).getRootPane().revalidate(); } } }
public void windowLostFocus(WindowEvent e) { e.getWindow().repaint(); } };
public void windowGainedFocus(WindowEvent e) { e.getWindow().repaint(); }
@Override public void actionPerformed(ActionEvent e) { final long elapsed = System.currentTimeMillis() - start; if (elapsed < duration && window.isShowing()) { final double angle = TWO_PI * elapsed / cycle; final double offset = Math.sin(PI * elapsed / duration) * amplitude; final int x = (int) (Math.cos(angle) * offset + origin.x); final int y = (int) (Math.sin(angle) * offset + origin.y); window.setLocation(x, y); window.repaint(); } else { ((Timer) e.getSource()).stop(); window.setLocation(origin); window.repaint(); } } });
@Override public void actionPerformed(ActionEvent e) { final long elapsed = System.currentTimeMillis() - start; if (elapsed < duration && window.isShowing()) { final double angle = TWO_PI * elapsed / cycle; final double offset = Math.sin(PI * elapsed / duration) * amplitude; final int x = (int) (Math.cos(angle) * offset + origin.x); final int y = (int) (Math.sin(angle) * offset + origin.y); window.setLocation(x, y); window.repaint(); } else { ((Timer) e.getSource()).stop(); window.setLocation(origin); window.repaint(); } } });
protected void cleanupGhostImage() { GlassPanel glassPane = manager.getGlassPanel(); glassPane.setDraggingImage(null); glassPane.setVisible(false); ghostImage = null; SwingUtilities.getWindowAncestor(manager).repaint(); }
public void stopShake() { shakeTimer.stop(); window.setLocation(naturalLocation); window.repaint(); SparkManager.getNativeManager().stopFlashing(window); }
public void run() { invalidate(); Window root = SGUI.getWindowParent(NodePanel.this); if(root!=null) { root.doLayout(); root.repaint(); } // paintComponents(getGraphics()); } });
public void windowDeactivated(WindowEvent e) { e.getWindow().invalidate(); e.getWindow().repaint(); } } // end class MyWindowHandler
public void windowActivated(WindowEvent e) { e.getWindow().invalidate(); e.getWindow().repaint(); }
public void actionPerformed(ActionEvent ae) { Dimension contentSize = null; if (w instanceof JDialog) { contentSize = ((JDialog)w).getContentPane().getSize(); } else { contentSize = ((JFrame)w).getContentPane().getSize(); } Dimension dialogSize = w.getSize(); int ydiff = dialogSize.height - contentSize.height; Dimension paneSize = pane.getSize(); w.setSize(new Dimension(dialogSize.width, paneSize.height + ydiff)); w.validate(); w.repaint(); } }
@Override public void actionPerformed(ActionEvent ae) { Dimension contentSize = null; if (w instanceof JDialog) { contentSize = ((JDialog)w).getContentPane().getSize(); } else { contentSize = ((JFrame)w).getContentPane().getSize(); } Dimension dialogSize = w.getSize(); int ydiff = dialogSize.height - contentSize.height; Dimension paneSize = pane.getSize(); w.setSize(new Dimension(dialogSize.width, paneSize.height + ydiff)); w.validate(); w.repaint(); } }
@Override public void actionPerformed(ActionEvent ae) { Dimension contentSize = null; if (w instanceof JDialog) { contentSize = ((JDialog)w).getContentPane().getSize(); } else { contentSize = ((JFrame)w).getContentPane().getSize(); } Dimension dialogSize = w.getSize(); int ydiff = dialogSize.height - contentSize.height; Dimension paneSize = pane.getSize(); w.setSize(new Dimension(dialogSize.width, paneSize.height + ydiff)); w.validate(); w.repaint(); } }
@Override public void actionPerformed(ActionEvent ae) { Dimension contentSize = null; if (w instanceof JDialog) { contentSize = ((JDialog)w).getContentPane().getSize(); } else { contentSize = ((JFrame)w).getContentPane().getSize(); } Dimension dialogSize = w.getSize(); int ydiff = dialogSize.height - contentSize.height; Dimension paneSize = pane.getSize(); w.setSize(new Dimension(dialogSize.width, paneSize.height + ydiff)); w.validate(); w.repaint(); } }
@Override public void actionPerformed(ActionEvent ae) { Dimension contentSize = null; if (w instanceof JDialog) { contentSize = ((JDialog)w).getContentPane().getSize(); } else { contentSize = ((JFrame)w).getContentPane().getSize(); } Dimension dialogSize = w.getSize(); int ydiff = dialogSize.height - contentSize.height; Dimension paneSize = pane.getSize(); w.setSize(new Dimension(dialogSize.width, paneSize.height + ydiff)); w.validate(); w.repaint(); } }
@Override protected void hidePanel(final Container p) { getParent().remove(p); getParent().revalidate(); getParent().repaint(); final Window w = SwingUtilities.getWindowAncestor(this); w.revalidate(); w.pack(); w.repaint(); } };
private void repaintWindows() { for (Window window : Window.getWindows()) { window.repaint(); } List<PopupInfo> popups = PopupPanelManager.defaultManager() .getShownPath(); for (PopupPanelManager.PopupInfo popup : popups) { JPopupPanel popupPanel = popup.getPopupPanel(); popupPanel.paintImmediately(new Rectangle(0, 0, popupPanel .getWidth(), popupPanel.getHeight())); } }
public class Start implements ActionListener { Window theWindow = new Window(); CustomPanel mainMenu = new CustomPanel(); CustomPanel optionsMenu = new CustomPanel(); Button myButton = new Button(); public static void main(String[] args) { theWindow.add(mainMenu); mainMenu.add(myButton); myButton.addActionListener(this); theWindow.setVisible(true); theWindow.repaint(); } public void actionPerformed(Event e) { theWindow.remove(mainMenu); theWindow.add(optionsMenu); theWindow.repaint(); }