package cn.ychx;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
public class CreateWebCode extends JFrame {
private static final long serialVersionUID = 1L;
public static final int WIDTH = 300;
public static final int HEIGHT = 500;
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable(){
@Override
public void run() {
CreateWebCode cwc = new CreateWebCode();
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension dimension = kit.getScreenSize();
cwc.setBounds((dimension.width - WIDTH)/2, (dimension.height - HEIGHT)/2, WIDTH, HEIGHT);
cwc.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
cwc.setVisible(true);
}
});
}
public CreateWebCode() {
String[] columnNames = { "Name", "Flag"};
Object[][] data = {
{"Tom","1"},
{"Alice","2"},
{"Jance","3"},
{"Babo","4"}
};
JTable table = new JTable(data, columnNames);
JScrollPane scrollPane = new JScrollPane(table);
add(scrollPane);
}
}