List of utility methods to do JComponent Width
void | setComponentWidth(final JComponent component, final int width) Adjust the width of the specified component. if ((component != null) && (width > 0)) { component.setMaximumSize(new Dimension(width, HEIGHT_ROW)); component.setPreferredSize(new Dimension(width, HEIGHT_ROW)); |
void | setMaximumWidth(final JComponent component, final int width) set Maximum Width final Dimension preferredSize = component.getPreferredSize(); final Dimension size = new Dimension(width, preferredSize.height); component.setMaximumSize(size); |
void | setMaximumWidth(JComponent component, int width) set Maximum Width component.setMaximumSize(new Dimension(width, (int) component.getMaximumSize().getHeight())); |
void | setMaxWidth(JComponent comp, int width) set Max Width comp.setMaximumSize(new Dimension(width, Short.MAX_VALUE));
|
void | setMinimumWidth(JComponent component, int minWidth) set Minimum Width Dimension dim = component.getMinimumSize();
dim = new Dimension(minWidth, dim.height);
component.setMinimumSize(dim);
|
void | setMinimumWidth(JComponent component, int width) set Minimum Width component.setMinimumSize(new Dimension(width, component.getMinimumSize().height));
|
void | setPreferredWidth(final JComponent component, final int width) Sets the preferred width of the specified component. component.setPreferredSize(new Dimension(width, component.getPreferredSize().height));
|
void | setPreferredWidth(final JComponent component, final int width) Sets the width of a JComponent without changing its height. final int height = (int) component.getPreferredSize().getHeight(); component.setPreferredSize(new Dimension(width, height)); |
void | setPreferredWidth(int width, JComponent... components) Sets all specified components to the same width. for (JComponent component : components) { component.setPreferredSize(new Dimension(width, component.getPreferredSize().height)); |
void | setPreferredWidth(JComponent comp, int iWidth) sets the preferred width of the given component (without changing its preferred height). comp.setPreferredSize(new Dimension(iWidth, getPreferredHeight(comp)));
|