List of usage examples for java.awt Dimension Dimension
public Dimension(Dimension d)
From source file:Main.java
/** * Returns dimension copy.//from www . j ava 2 s .c om * * @param dimension * dimension to copy * @return dimension copy */ public static Dimension copy(final Dimension dimension) { return new Dimension(dimension); }
From source file:Main.java
public static void constrainResize(ComponentEvent componentevent) { Component component = componentevent.getComponent(); Dimension dimension = component.getSize(); Dimension dimension1 = component.getMinimumSize(); Dimension dimension2 = new Dimension(dimension); boolean flag = false; if (dimension.width < dimension1.width) { flag = true;/*from w w w . ja v a 2s . c om*/ dimension2.width = dimension1.width; } if (dimension.height < dimension1.height) { flag = true; dimension2.height = dimension1.height; } if (flag) component.setSize(dimension2); }