import javax.swing.*;
import java.awt.*;
public class Main{
public static void main(String[] args){
new Main();
}
public Main(){
frame = new JFrame("JTable Application");
String[][] cells = {
{"1", "Lady Gaga", "New York"},
{"2", "Aura Kasih", "Jakarta'],
{"3", "Luna Maya", "Denpasar"}
};
String[] column = {"No", "Name", "City"};
table = new JTable(cells, column);
frame.add(new JScrollPane(table));
frame.setSize(400, 300);
frame.setLocation(200, 100);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
private JFrame frame;
private JTable table;
}
No comments:
Post a Comment