Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.awt.Dimension;

import javax.swing.JFrame;

public class Main {
    /**
     * Instances frame basics
     * @param mainView Frame which has been created.
     */
    public static void instanceDefaults(JFrame mainView) {
        mainView.setLocationRelativeTo(null);
        mainView.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        mainView.pack();
        mainView.setVisible(true);
    }

    /**
     * @param mainView
     * @param preferredWidth Frame preferred width.
     * @param preferredHeight Frame preferred height.
     */
    public static void instanceDefaults(JFrame mainView, int preferredWidth, int preferredHeight) {
        mainView.getContentPane().setPreferredSize(new Dimension(preferredWidth, preferredHeight));
        instanceDefaults(mainView);
    }
}