Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.BorderLayout;

import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class Main {
    public static void main(String[] args) {
        String[] ITEMS1 = { "one", "two", "three", "four", "five" };
        String[] ITEMS2 = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" };

        JPanel northPanel = new JPanel();
        northPanel.add(new JCheckBox("Reminder"));
        northPanel.add(new JComboBox(ITEMS1));
        northPanel.add(new JComboBox(ITEMS2));

        JPanel p = new JPanel(new BorderLayout());

        p.add(northPanel, BorderLayout.NORTH);
        p.add(new JScrollPane(new JTextArea(8, 30)), BorderLayout.CENTER);

        JFrame frame = new JFrame();
        frame.getContentPane().add(p);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
    }
}