Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.ComponentOrientation;
import java.awt.Dimension;
import java.awt.FlowLayout;

import javax.swing.JPanel;

public class Main {
    public static JPanel getPanelFlowLayoutHorizontal(int w, int h, int type) {
        JPanel panel = new JPanel();
        FlowLayout layout = new FlowLayout();
        layout.setAlignment(type);
        panel.setLayout(layout);
        panel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
        panel.setPreferredSize(getControlDimension(w, h));
        panel.setMinimumSize(getControlDimension(w, h));
        return panel;
    }

    public static Dimension getControlDimension(int w, int h) {
        return new Dimension(w, h);
    }
}