Here you can find the source of setMaximumHeight(JComponent comp, int iHeight)
Parameter | Description |
---|---|
comp | a parameter |
iHeight | a parameter |
public static void setMaximumHeight(JComponent comp, int iHeight)
//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; } }