Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.Dimension;
import javax.swing.JComponent;

public class Main {
    public static void sizeIt(JComponent c, int width, int height) {
        if (height < 0) {
            height = c.getPreferredSize().height;
        }
        Dimension myDimension = new Dimension(width, height);
        c.setMaximumSize(myDimension);
        c.setMinimumSize(myDimension);
        c.setPreferredSize(myDimension);
    }
}