Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.Component;
import java.awt.Dimension;

public class Main {
    /** Sets maximum width of the component, leaving the height intact. */
    public static void setMaximumWidth(Component component, int width) {
        Dimension dim = component.getMaximumSize();
        component.setMaximumSize(new Dimension(width, dim.height));
    }
}