List of utility methods to do JComponent Height
void | adjustHeight(JComponent comp, int height) adjust Height Dimension size = comp.getMinimumSize(); size.height = height; comp.setMinimumSize(size); size = comp.getPreferredSize(); size.height = height; comp.setPreferredSize(size); |
void | fixHeight(JComponent c, int height) fix Height Dimension ps = c.getPreferredSize();
c.setPreferredSize(new Dimension(ps.width, height));
c.setMinimumSize(c.getPreferredSize());
c.setMaximumSize(c.getPreferredSize());
|
int | getComponentHeight(JComponent component) get Component Height int height = component.getHeight(); return (height > 0 ? height : component.getPreferredSize().height); |
int | getMinimumHeight(JComponent comp) get Minimum Height return comp.getMinimumSize().height;
|
void | heighten(JComponent component, int px) heighten pad(component, 0, px); |
void | makeEqualHeight(JComponent reference, JComponent... others) make Equal Height if (reference == null) return; if (others == null) return; int height = reference.getPreferredSize().height; for (JComponent comp : others) { Dimension size = comp.getPreferredSize(); size.height = height; ... |
void | normalizeHeight(JComponent... components) Sets all specified components to the same height. int height = 0; for (JComponent component : components) { if (component.getPreferredSize().height > height) { height = component.getPreferredSize().height; setPreferredHeight(height, components); |
void | sameHeight(JComponent[] components, int height) same Height for (int i = 0; i < components.length; i++) { Dimension size = components[i].getSize(); size.height = height; components[i].setSize(size); |
void | setComponentHeight(JComponent setme, JComponent getme) Set the component height to that of another component. setComponentHeight(setme, getme, 0); |
void | setMaxHeightToPreferred(JComponent component) Sets the maximum size of a JComponent to the preferred size component.setMaximumSize(new Dimension(Integer.MAX_VALUE, component.getPreferredSize().height));
|