【初心者】Java質問・相談スレッド121【歓迎】 at TECH
[2ch|▼Menu]
98:デフォルトの名無しさん
08/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); }});
}}


次ページ
続きを表示
1を表示
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

4483日前に更新/251 KB
担当:undef