From: <br...@us...> - 2002-10-31 11:57:01
|
Update of /cvsroot/marathonman/marathon/src/sampleapp In directory usw-pr-cvs1:/tmp/cvs-serv4755/src/sampleapp Modified Files: SampleApp.java Log Message: Added table click and assert function Index: SampleApp.java =================================================================== RCS file: /cvsroot/marathonman/marathon/src/sampleapp/SampleApp.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SampleApp.java 28 Oct 2002 06:17:05 -0000 1.5 --- SampleApp.java 31 Oct 2002 11:56:57 -0000 1.6 *************** *** 2,5 **** --- 2,6 ---- import javax.swing.*; + import javax.swing.table.DefaultTableModel; import java.awt.FlowLayout; import java.awt.event.ActionEvent; *************** *** 33,37 **** public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(_dialog, "Message Dialog", "Message Dialog", ! JOptionPane.INFORMATION_MESSAGE); } }); --- 34,38 ---- public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(_dialog, "Message Dialog", "Message Dialog", ! JOptionPane.INFORMATION_MESSAGE); } }); *************** *** 51,54 **** --- 52,76 ---- _dialog.getContentPane().add(table); + String[][] value = new String[][]{ + {"0,0", "1,0", "2,0"}, + {"0,1", "1,1", "1,2"}, + {"0,2", "1,2", "2,2"} + }; + + String[] column = new String[]{"Column1", "Column2", "Column3"}; + JTable table2 = new JTable(value, column); + table2.setName("sample non-editable table"); + table2.setModel(new DefaultTableModel( + new String[][]{ + {"0,0", "1,0", "2,0"}, + {"0,1", "1,1", "1,2"}, + {"0,2", "1,2", "2,2"} + }, new String[]{"Column1", "Column2", "Column3"} + ){ + public boolean isCellEditable(int row, int column) { + return false; + } + }); + _dialog.getContentPane().add(table2); _dialog.pack(); |