Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;

import javax.swing.JFrame;

public class Main {
    public static void main(String[] args) {
        JFrame f = new JFrame("Fixed size content");
        f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        Container c = f.getContentPane();
        c.setBackground(Color.YELLOW);

        Dimension d = new Dimension(400, 40);
        c.setPreferredSize(d);
        f.pack();
        f.setResizable(false);
        f.setVisible(true);
    }
}