2012-03-07 10 views
0

jQueryとデータベースのデータ変更に対応するために、削除、挿入、更新ボタンを追加するのが好きです。 guiを使ってアクションにボタンをリンクできますか?jtableデータを実行するために更新、削除、挿入ボタンを追加する

+1

正確に問題はありますか?バインディング、データベース操作、テーブルデータの変更、アクション...?具体的にしてください。 – kleopatra

答えて

1

ActionListenerを使用して同様の方法でCRUD演算子ボタンを実装できます。行を挿入する例は次のとおりです。

JTable table = new JTable(model); 
JButton button = new JButton(); 
button.addActionListener(new ActionListener() 
{ 
    public void actionPerformed(ActionEvent arg0) 
    { 
     model.insertRow(0, new Object[]{"your data"}); 
     // The above line manipulates data only in JTable. 
     // To reflect it on the database, add your SQL queries to this method. 
    } 
}) 
関連する問題