public static void adjustWindowToMinimumSize(final Window window) { if (window == null) return; final Dimension minSize = window.getMinimumSize(); final Dimension size = window.getSize(); final Dimension newSize = new Dimension(Math.max(size.width, minSize.width), Math.max(size.height, minSize.height)); if (!newSize.equals(size)) { //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (window.isShowing()) { window.setSize(newSize); } } }); } }
public static void setupEnclosingDialogBounds(final JComponent component) { component.revalidate(); component.repaint(); final Window window = SwingUtilities.windowForComponent(component); if (window != null && (window.getSize().height < window.getMinimumSize().height || window.getSize().width < window.getMinimumSize().width)) { window.pack(); } }
/** * Sets the Shaded attribute of the SkinWindowWindow object * * @param b The new Shaded value */ public void setShaded(boolean b) { java.awt.Window window = (frame == null)?(java.awt.Window)dialog :(java.awt.Window)frame; if (window == null || b == shaded) { return; } if (b == true) { Rectangle bounds = window.getBounds(); oldBounds = new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height); window.setBounds(oldBounds.x, oldBounds.y, oldBounds.width, window .getMinimumSize().height - 2); } else { Point location = window.getLocation(); window.setBounds(location.x, location.y, oldBounds.width, oldBounds.height); oldBounds = null; } shaded = b; }
if( owner != null && owner.isShowing() && (owner.getMinimumSize().height < owner.getHeight()) )
if( owner != null && owner.isShowing() && (owner.getMinimumSize().height < owner.getHeight()) )
if( owner != null && owner.isShowing() && (owner.getMinimumSize().height < owner.getHeight()) )
Rectangle r = w.getBounds(); Rectangle startBounds = new Rectangle(r); Dimension min = w.getMinimumSize();
Rectangle r = w.getBounds(); Rectangle startBounds = new Rectangle(r); Dimension min = w.getMinimumSize();
Rectangle r = w.getBounds(); Rectangle startBounds = new Rectangle(r); Dimension min = w.getMinimumSize();
Dimension min = w.getMinimumSize();
Rectangle r = w.getBounds(); Rectangle startBounds = new Rectangle(r); Dimension min = w.getMinimumSize();