Mercurial > hg > RemoteEditor > REPSessionManager
view test/DefaultTableModelTest.java @ 320:83790b8b8174
*** empty log message ***
author | kono |
---|---|
date | Fri, 10 Oct 2008 14:10:15 +0900 |
parents | |
children |
line wrap: on
line source
package test; import java.awt.*; import javax.swing.*; import javax.swing.table.*; class DefaultTableModelTest extends JFrame { /** * */ private static final long serialVersionUID = 1L; 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(); } }