01: /*
02: * Copyright (C) 2005 Jeff Tassin
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package com.jeta.swingbuilder.gui.components;
20:
21: import java.awt.BorderLayout;
22: import java.util.Enumeration;
23: import java.util.Properties;
24:
25: import javax.swing.JComponent;
26:
27: import com.jeta.open.gui.framework.JETAPanel;
28: import com.jeta.open.i18n.I18N;
29:
30: /**
31: * This class displays Java System properties in a table.
32: *
33: * @author Jeff Tassin
34: */
35: public class SystemPropertiesPanel extends JETAPanel {
36: /** the model for holding the Java system properties */
37: private JETATableModel m_model;
38:
39: /**
40: * ctor
41: */
42: public SystemPropertiesPanel() {
43: initialize();
44: }
45:
46: /**
47: * Creates the JTable that displays the JDBC driver properties
48: *
49: * @returns the table component
50: */
51: private JComponent createInfoTable() {
52: m_model = new JETATableModel();
53:
54: String[] names = new String[2];
55: names[0] = I18N.getLocalizedMessage("Property");
56: names[1] = I18N.getLocalizedMessage("Value");
57: m_model.setColumnNames(names);
58:
59: Class[] coltypes = new Class[2];
60: coltypes[0] = String.class;
61: coltypes[1] = String.class;
62: m_model.setColumnTypes(coltypes);
63:
64: return new javax.swing.JScrollPane(TableUtils
65: .createBasicTablePanel(m_model, true));
66: }
67:
68: /**
69: * Creates the components on this panel
70: */
71: private void initialize() {
72: setLayout(new BorderLayout());
73: add(createInfoTable(), BorderLayout.CENTER);
74:
75: // load the data
76: try {
77: Properties props = System.getProperties();
78: Enumeration names = props.propertyNames();
79: while (names.hasMoreElements()) {
80: String name = (String) names.nextElement();
81: String value = props.getProperty(name);
82: Object[] row = new Object[2];
83: row[0] = name;
84: row[1] = value;
85: m_model.addRow(row);
86: }
87: } catch (Exception e) {
88:
89: }
90: }
91:
92: }
|