Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JScrollPane;

public class Main {

    public static void main(final String args[]) {
        String labels[] = { "A", "B", "C", "D", "E" };
        JFrame frame = new JFrame("Selection Modes");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JList list1 = new JList(labels);
        JScrollPane sp1 = new JScrollPane(list1);
        sp1.setColumnHeaderView(new JLabel("List"));
        frame.add(sp1, BorderLayout.CENTER);
        frame.setSize(300, 200);
        frame.setVisible(true);

    }
}