Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.awt.Component;
import java.awt.Dimension;

public class Main {
    public static void setPreferredWidth(Component component, int width) {
        component.setPreferredSize(new Dimension(width, component.getPreferredSize().height));
    }
}