Here you can find the source of setPreferredHeight(final JComponent component, final int height)
Parameter | Description |
---|---|
component | The component |
height | The preferred height |
public static void setPreferredHeight(final JComponent component, final int height)
//package com.java2s; /*/* www. j a v a 2 s.c o m*/ * Copyright (C) 2009 Klaus Reimer <k@ailis.de> * See LICENSE.md for licensing information. */ import java.awt.Dimension; import javax.swing.JComponent; public class Main { /** * Sets the preferred height of the specified component. * * @param component * The component * @param height * The preferred height */ public static void setPreferredHeight(final JComponent component, final int height) { component.setPreferredSize(new Dimension(component.getPreferredSize().width, height)); } }