Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.Dimension;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;

public class Main {

    public static void main(String args[]) {
        JTable table = new JTable(22, 5);
        table.setPreferredScrollableViewportSize(new Dimension(400, 300));
        final JScrollPane scrollPane = new JScrollPane(table);
        JButton cornerButton = new JButton("#");
        scrollPane.setCorner(JScrollPane.UPPER_TRAILING_CORNER, cornerButton);
        scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

        JFrame frame = new JFrame();
        frame.add(scrollPane);
        frame.pack();
        frame.setVisible(true);
    }
}