MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.awt.BorderLayout;

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

public class MainClass {

    public static void main(final String args[]) {
        final String labels[] = { "A", "B", "C", "D", "E" };
        JFrame frame = new JFrame("Multi-Columns");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JList columns = new JList(labels);
        columns.setLayoutOrientation(JList.HORIZONTAL_WRAP);
        columns.setVisibleRowCount(3);
        JScrollPane sp = new JScrollPane(columns);
        frame.add(sp, BorderLayout.CENTER);
        frame.setSize(300, 200);
        frame.setVisible(true);

    }

}