set JComponent Size - Java Swing

Java examples for Swing:JComponent

Description

set JComponent Size

Demo Code


//package com.java2s;

import java.awt.Dimension;

import javax.swing.JComponent;

public class Main {
    public static void setSize(JComponent widget, Dimension size) {
        widget.setMinimumSize(size);/* w  w  w  . j av  a2  s . c  om*/
        widget.setMaximumSize(size);
        widget.setPreferredSize(size);
    }
}

Related Tutorials