List of utility methods to do JComponent Size
void | setAllSizes(JComponent component, int width, int height) set the component's minimum, maximum and preferred sizes Dimension dim = new Dimension(width, height);
component.setMinimumSize(dim);
component.setMaximumSize(dim);
component.setPreferredSize(dim);
|
void | setComponentSize(int width, int height, JComponent l) set Component Size l.setPreferredSize(new Dimension(width, height)); l.setMinimumSize(new Dimension(width, height)); if (l instanceof JTextField || l instanceof JComboBox) { l.setMaximumSize(new Dimension(Short.MAX_VALUE, height)); |
void | setComponentSize(JComponent comp, int defWidth, int defHeight, Preferences prefs, String name) Set the preferred size of a JComponent by restoring from package Preferences object. if (defWidth == 0 || defHeight == 0) { String width = prefs.get(name + "_width", null); if (width == null) { return; int width = prefs.getInt(name + "_width", defWidth); int height = prefs.getInt(name + "_height", defHeight); ... |
void | setComponentSize(JComponent comp, int width, int height) set Component Size comp.setPreferredSize(new Dimension(width, height));
comp.setMinimumSize(comp.getPreferredSize());
comp.setMaximumSize(comp.getPreferredSize());
|
void | setFixedSize(JComponent component, Dimension size) set Fixed Size component.setPreferredSize(size); component.setMinimumSize(size); component.setMaximumSize(size); |
void | setFixedSize(JComponent component, Dimension size) set Fixed Size component.setPreferredSize(size); component.setMinimumSize(size); component.setMaximumSize(size); |
void | setFixedSize(JComponent component, int width, int height) Set the fixed size to given component. Dimension size = new Dimension(width, height);
component.setMaximumSize(size);
component.setMinimumSize(size);
component.setPreferredSize(size);
|
void | setMaximumSize(Dimension d, JComponent... components) Set the maximum size of the given components. for (JComponent c : components) {
c.setMaximumSize(d);
|
void | setMaximumSize(Dimension maxComponentSize, JComponent component) set Maximum Size final Dimension componentSize = component.getPreferredSize(); maxComponentSize.width = Math.max(maxComponentSize.width, (int) componentSize.getWidth()); maxComponentSize.height = Math.max(maxComponentSize.height, (int) componentSize.getHeight()); |
void | setMaxPreferredSize(JComponent comp) set Max Preferred Size comp.setPreferredSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
|