Java JComponent Height setMaximumHeight(JComponent comp, int iHeight)

Here you can find the source of setMaximumHeight(JComponent comp, int iHeight)

Description

sets the maximum height of the given component (without changing its maximum width).

License

Open Source License

Parameter

Parameter Description
comp a parameter
iHeight a parameter

Declaration

public static void setMaximumHeight(JComponent comp, int iHeight) 

Method Source Code

//package com.java2s;
//it under the terms of the GNU Affero General Public License as published by

import java.awt.Dimension;

import javax.swing.JComponent;

public class Main {
    /**/*from ww  w.j ava  2  s .  com*/
     * sets the maximum height of the given component (without changing its maximum width).
     * @param comp
     * @param iHeight
     */
    public static void setMaximumHeight(JComponent comp, int iHeight) {
        comp.setMaximumSize(new Dimension(getMaximumWidth(comp), iHeight));
    }

    /**
     * @param comp
     * @return comp.getMaximumSize().width
     */
    public static int getMaximumWidth(JComponent comp) {
        return comp.getMaximumSize().width;
    }
}

Related

  1. makeEqualHeight(JComponent reference, JComponent... others)
  2. normalizeHeight(JComponent... components)
  3. sameHeight(JComponent[] components, int height)
  4. setComponentHeight(JComponent setme, JComponent getme)
  5. setMaxHeightToPreferred(JComponent component)
  6. setMinimumHeight(JComponent component, int height)
  7. setPreferredHeight(final JComponent component, final int height)
  8. setPreferredHeight(int height, JComponent... components)
  9. setPreferredHeight(JComponent component, int height)