Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import javax.swing.*;
import javax.swing.border.EmptyBorder;

import java.awt.*;

public class Main {
    public static JPanel createVerticalPanel(Component[] cms) {
        return createVerticalPanel(cms, 0);
    }

    public static JPanel createVerticalPanel(Component[] cms, int vgap) {

        JPanel pane = new JPanel(new GridLayout(cms.length, 1, 0, vgap));
        for (Component c : cms) {
            pane.add(c);
        }
        return pane;
    }

    public static JPanel createVerticalPanel(Component topCmp, Component centerCmp) {
        JPanel outPane = new JPanel();
        outPane.setLayout(new BorderLayout());
        outPane.setBorder(new EmptyBorder(5, 5, 5, 5));

        outPane.add(topCmp, BorderLayout.NORTH);
        outPane.add(centerCmp, BorderLayout.CENTER);

        return outPane;
    }
}