Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import javax.swing.JPanel;

public class Main {
    /**
     * "Wraps" a component in a JPanel. In layouts where components tend to stretch, this is
     * useful because the JPanel will stretch but the actual component will not.
     * @return A JPanel containing the specified component.
     */
    public static JPanel box(Component component) {
        JPanel panel = new JPanel();
        panel.add(component);
        return panel;
    }
}