- 98 名前:デフォルトの名無しさん mailto:sage [2008/11/20(木) 19:10:44 ]
- >>97
試してみたけど大丈夫だったよ (import省略) public class Test{ public static void main(String[] args){ final Object[] columns = { "x" }; final Object[][] dataA = {{ "1111" }, { "2222" }, { "3333" }, { "4444" }}; final Object[][] dataB = {{ "5555" }, { "6666" }, { "7777" }, { "8888" }}; final JTable table = new JTable(dataA, columns); JButton button = new JButton("update"); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ table.setModel(new DefaultTableModel(dataB, columns)); }}); final JFrame frame = new JFrame(); frame.add(table); frame.add(button, BorderLayout.PAGE_END); SwingUtilities.invokeLater(new Runnable(){ public void run(){ frame.pack(); frame.setVisible(true); }}); }}
|

|