Here you can find the source of setFixedSize(JComponent component, int width, int height)
Set the fixed size to given component.
Parameter | Description |
---|---|
component | the component to set |
width | the fixed width |
height | the fixed height |
public static void setFixedSize(JComponent component, int width, int height)
//package com.java2s; import java.awt.Dimension; import javax.swing.JComponent; public class Main { /**/*from w w w. j a v a 2 s. com*/ * <p> * Set the fixed size to given component. * </p> * @param component the component to set * @param width the fixed width * @param height the fixed height * @since 1.1 */ public static void setFixedSize(JComponent component, int width, int height) { Dimension size = new Dimension(width, height); component.setMaximumSize(size); component.setMinimumSize(size); component.setPreferredSize(size); } }