List of usage examples for java.awt Dimension Dimension
public Dimension(int width, int height)
From source file:Main.java
public static void setPreferredWidth(Component component, int width) { component.setPreferredSize(new Dimension(width, component.getPreferredSize().height)); }
From source file:Main.java
public static void setComponent3Width(JComponent c, int width) { Dimension d = new Dimension(width, c.getPreferredSize().height); set3Dimensions(c, d);//from ww w . jav a 2 s . c o m }
From source file:Main.java
public static void forceSize(JComponent component, int width, int height) { Dimension d = new Dimension(width, height); component.setMinimumSize(d);/* w ww . ja v a 2 s.c o m*/ component.setMaximumSize(d); component.setPreferredSize(d); }
From source file:Main.java
public static void setSizes(Component comp, Dimension dim) { comp.setMinimumSize(dim);/*from w ww . j av a2s. c o m*/ comp.setPreferredSize(dim); comp.setMaximumSize(new Dimension(Short.MAX_VALUE, (int) comp.getPreferredSize().getHeight())); }
From source file:Main.java
public static final void defaultSize(Component component) { Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); Dimension size = new Dimension((int) (screen.getWidth() * 2 / 3), (int) (screen.getHeight() * 0.8)); component.setSize(size);/* w ww .j a v a 2 s . c o m*/ }
From source file:Main.java
public static void sizeIt(JComponent c, int width, int height) { if (height < 0) { height = c.getPreferredSize().height; }//from w w w.jav a2 s .c om Dimension myDimension = new Dimension(width, height); c.setMaximumSize(myDimension); c.setMinimumSize(myDimension); c.setPreferredSize(myDimension); }
From source file:Main.java
/** Sets maximum width of the component, leaving the height intact. */ public static void setMaximumWidth(Component component, int width) { Dimension dim = component.getMaximumSize(); component.setMaximumSize(new Dimension(width, dim.height)); }
From source file:Main.java
/** * Fixes the height of the component but maintaining it old width. * * @param comp//ww w .j a v a 2 s . c om * @param height */ public static void fixHeight(JComponent comp, int height) { comp.setPreferredSize(new Dimension(comp.getPreferredSize().width, height)); }
From source file:Main.java
/** Sets preferred width of the component, leaving the height intact. */ public static void setPreferredWidth(Component component, int width) { Dimension dim = component.getPreferredSize(); component.setPreferredSize(new Dimension(width, dim.height)); }
From source file:Main.java
public static void resizeToScreenProportions(Component component, double xProportion, double yProportion) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension componentNewSize = new Dimension((int) (screenSize.width * yProportion), (int) (screenSize.height * xProportion)); component.setSize(componentNewSize); }