/[xulu]/trunk/src/appl/parallel/gui/SimplePropertyTable.java
ViewVC logotype

Annotation of /trunk/src/appl/parallel/gui/SimplePropertyTable.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations)
Wed Feb 25 11:54:01 2009 UTC (15 years, 9 months ago) by mojays
File size: 1044 byte(s)
First Commit, corresponds to Revision 1008 of Wikisquare-SVN 
1 mojays 2 package appl.parallel.gui;
2    
3     import java.util.Enumeration;
4     import java.util.Iterator;
5     import java.util.Properties;
6    
7     import javax.swing.JTable;
8     import javax.swing.table.DefaultTableModel;
9    
10     /**
11     * Just a simple 2 column Property Table
12     *
13     * @author Dominik Appl
14     */
15     public class SimplePropertyTable extends JTable {
16    
17     private final String colname1;
18    
19     private final String colname2;
20    
21     public SimplePropertyTable(String colname1, String colname2) {
22     super(1, 2);
23     this.colname1 = colname1;
24     this.colname2 = colname2;
25    
26     }
27    
28     public SimplePropertyTable() {
29     this("Property", "Value");
30     }
31    
32     public void setPropertyData(Properties propdata) {
33     Enumeration keys = propdata.keys();
34     // Create array
35     String[][] data = new String[propdata.size()][2];
36     int i = 0;
37     while (keys.hasMoreElements()) {
38     data[i][0] = (String) keys.nextElement();
39     data[i][1] = (String) propdata.getProperty(data[i][0]);
40     i++;
41     }
42     setModel(new DefaultTableModel(data,
43     new String[] { colname1, colname2 }));
44     }
45    
46     }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26