import javax.swing.*; import ushi.jdbc.*; import ushi.ui.*; import ushi.util.*; class Tap1 extends TableActionPanel { public Tap1(TablePane tp){ super(tp); } public void close(){ System.exit(0); } } /** 2002/03/03 */ public class TableExample extends GridApplet { TableActionPanel tap; public TableExample() { String[] colnames = {"ID","メールアドレス","SMTP","POP3","アカウント","パスワード","Webサイト","連絡先"}; setSize(400, 300); try { DbcmAdaptor adaptor = new DbcmSimpleAdaptor("mysql", "localhost", 3306, "udb", "urano", "urano398"); DataStoreTableModel tamo = new DataStoreTableModel(); tamo.setAdaptor(adaptor); tamo.setColumnNames(colnames); tamo.setQuery( "select address_code, address, smtp_server, pop_server, " + " account, password, web_site, parent_address " + " from mail_address"); tamo.setParams(null); tamo.setUpdateTarget("mail_address"); tamo.setPrimaryKey(0); TablePane tp = new TablePane(tamo, 390, 200); tp.configureColumn(0, 8*8); tp.configureColumn(1, 8*20); tp.configureColumn(2, 8*20); tp.configureColumn(3, 8*20); tp.configureColumn(4, 8*8); tp.configureColumn(5, 8*8); tp.configureColumn(6, 8*20); tp.configureColumn(7, 8*20); tap = new Tap1(tp); add(tp, 0, 0); add(tap, 0, 1); } catch(MissSpecException ex){ ex.printStackTrace(); } } public static void main(String[] args){ JFrame f = new JFrame("テーブルのサンプル"); f.setSize(400, 300); TableExample my = new TableExample(); my.init(); f.getContentPane().add(my); f.show(); } } /* end. */