Mercurial > hg > RemoteEditor > REPSessionManager
view rep/gui/DefaultTableModelTest.java @ 84:54334d83194a
*** empty log message ***
author | pin |
---|---|
date | Fri, 21 Dec 2007 16:03:04 +0900 |
parents | 593f915dd6ff |
children | 8dce4348966c |
line wrap: on
line source
package rep.gui; import java.awt.*; import javax.swing.*; import javax.swing.table.*; class DefaultTableModelTest extends JFrame { DefaultTableModelTest() { getContentPane().setLayout(new FlowLayout()); String[][] rowData = { { "A1", "B1", "C1" }, { "A2", "B2", "C2" }, { "A3", "B3", "C3" }, { "A4", "B4", "C4" }, }; String[] colNames = { "A", "B", "C" }; DefaultTableModel tm = new DefaultTableModel(rowData, colNames); JTable tb = new JTable(tm); JScrollPane sp = new JScrollPane(tb); sp.setPreferredSize(new Dimension(230, 80)); getContentPane().add(sp); String[] data = { "A5", "B5", "C5" }; tm.addRow(data); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setTitle("DefaultTableModelTest"); setSize(250, 120); setVisible(true); } public static void main(String[] args) { new DefaultTableModelTest(); } }