1 22 package org.enhydra.multiServer.launch; 23 24 import java.awt.*; 26 import java.beans.*; 27 import javax.swing.*; 28 import javax.swing.border.Border ; 29 import javax.swing.border.TitledBorder ; 30 31 public class InfoPanel extends JPanel { 33 private GridBagLayout layoutMain; 34 private JPanel panelUser; 35 private JPanel panelSystem; 36 private JPanel panelJava; 37 private JPanel panelClassPath; 38 private GridBagLayout layoutUser; 39 private GridBagLayout layoutSystem; 40 private GridBagLayout layoutJava; 41 private JLabel labelName; 42 private JLabel labelWorking; 43 private JLabel labelHome; 44 private JTextField textName; 45 private JTextField textWorking; 46 private JTextField textHome; 47 private JLabel labelSystemName; 48 private JLabel labelSystemArch; 49 private JTextField textSystemName; 50 private JTextField textSystemArch; 51 private JLabel labelJavaHome; 52 private JLabel labelVendor; 53 private JLabel labelVersion; 54 private JTextField textJavaHome; 55 private JTextField textVendor; 56 private JTextField textVersion; 57 private JTextArea textClassPath; 58 private JScrollPane scrollClassPath; 59 private BorderLayout layoutClassPath; 60 61 public InfoPanel() { 62 try { 63 jbInit(); 64 pmInit(); 65 } catch (Exception ex) { 66 ex.printStackTrace(); 67 } 68 } 69 70 private void pmInit() { 71 textHome.setText(System.getProperty("user.home")); 72 textWorking.setText(System.getProperty("user.dir")); 73 textName.setText(System.getProperty("user.name")); 74 textSystemName.setText(System.getProperty("os.name")); 75 textSystemArch.setText(System.getProperty("os.arch")); 76 textJavaHome.setText(System.getProperty("java.home")); 77 textVendor.setText(System.getProperty("java.vendor")); 78 textVersion.setText(System.getProperty("java.version")); 79 textClassPath.append(System.getProperty("java.class.path")); 80 } 81 82 private void jbInit() throws Exception { 83 layoutMain = 84 (GridBagLayout) Beans.instantiate(getClass().getClassLoader(), 85 GridBagLayout.class.getName()); 86 panelUser = (JPanel) Beans.instantiate(getClass().getClassLoader(), 87 JPanel.class.getName()); 88 panelSystem = (JPanel) Beans.instantiate(getClass().getClassLoader(), 89 JPanel.class.getName()); 90 panelJava = (JPanel) Beans.instantiate(getClass().getClassLoader(), 91 JPanel.class.getName()); 92 panelClassPath = 93 (JPanel) Beans.instantiate(getClass().getClassLoader(), 94 JPanel.class.getName()); 95 layoutUser = 96 (GridBagLayout) Beans.instantiate(getClass().getClassLoader(), 97 GridBagLayout.class.getName()); 98 layoutSystem = 99 (GridBagLayout) Beans.instantiate(getClass().getClassLoader(), 100 GridBagLayout.class.getName()); 101 layoutJava = 102 (GridBagLayout) Beans.instantiate(getClass().getClassLoader(), 103 GridBagLayout.class.getName()); 104 labelName = (JLabel) Beans.instantiate(getClass().getClassLoader(), 105 JLabel.class.getName()); 106 labelWorking = (JLabel) Beans.instantiate(getClass().getClassLoader(), 107 JLabel.class.getName()); 108 labelHome = (JLabel) Beans.instantiate(getClass().getClassLoader(), 109 JLabel.class.getName()); 110 textName = (JTextField) Beans.instantiate(getClass().getClassLoader(), 111 JTextField.class.getName()); 112 textWorking = 113 (JTextField) Beans.instantiate(getClass().getClassLoader(), 114 JTextField.class.getName()); 115 textHome = (JTextField) Beans.instantiate(getClass().getClassLoader(), 116 JTextField.class.getName()); 117 labelSystemName = 118 (JLabel) Beans.instantiate(getClass().getClassLoader(), 119 JLabel.class.getName()); 120 labelSystemArch = 121 (JLabel) Beans.instantiate(getClass().getClassLoader(), 122 JLabel.class.getName()); 123 textSystemName = 124 (JTextField) Beans.instantiate(getClass().getClassLoader(), 125 JTextField.class.getName()); 126 textSystemArch = 127 (JTextField) Beans.instantiate(getClass().getClassLoader(), 128 JTextField.class.getName()); 129 labelJavaHome = 130 (JLabel) Beans.instantiate(getClass().getClassLoader(), 131 JLabel.class.getName()); 132 labelVendor = (JLabel) Beans.instantiate(getClass().getClassLoader(), 133 JLabel.class.getName()); 134 labelVersion = (JLabel) Beans.instantiate(getClass().getClassLoader(), 135 JLabel.class.getName()); 136 textJavaHome = 137 (JTextField) Beans.instantiate(getClass().getClassLoader(), 138 JTextField.class.getName()); 139 textVendor = 140 (JTextField) Beans.instantiate(getClass().getClassLoader(), 141 JTextField.class.getName()); 142 textVersion = 143 (JTextField) Beans.instantiate(getClass().getClassLoader(), 144 JTextField.class.getName()); 145 textClassPath = 146 (JTextArea) Beans.instantiate(getClass().getClassLoader(), 147 JTextArea.class.getName()); 148 149 layoutClassPath = 151 (BorderLayout) Beans.instantiate(getClass().getClassLoader(), 152 BorderLayout.class.getName()); 153 labelName.setText("Name:"); 154 labelWorking.setText("Working directory:"); 155 labelHome.setText("Home directory:"); 156 textName.setEditable(false); 157 textName.setText("USER HOME"); 158 textWorking.setEditable(false); 159 textWorking.setText("USER WORKING DIRECTORY"); 160 textHome.setEditable(false); 161 textHome.setText("USER HOME DIRECTORY"); 162 panelUser.setLayout(layoutUser); 163 panelUser.setBorder(BorderFactory.createTitledBorder("User")); 164 labelJavaHome.setText("Java home:"); 165 labelVendor.setText("Vendor:"); 166 labelVersion.setText("Version:"); 167 textJavaHome.setEditable(false); 168 textJavaHome.setText("JAVA HOME"); 169 textVendor.setEditable(false); 170 textVendor.setText("JAVA VENDOR"); 171 textVersion.setEditable(false); 172 textVersion.setText("JAVA VERSION"); 173 textClassPath.setLineWrap(true); 174 textClassPath.setWrapStyleWord(true); 175 panelUser.add(labelName, 176 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 177 GridBagConstraints.WEST, 178 GridBagConstraints.HORIZONTAL, 179 new Insets(5, 5, 2, 5), 0, 0)); 180 panelUser.add(labelWorking, 181 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 182 GridBagConstraints.WEST, 183 GridBagConstraints.HORIZONTAL, 184 new Insets(2, 5, 2, 5), 0, 0)); 185 panelUser.add(labelHome, 186 new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 187 GridBagConstraints.WEST, 188 GridBagConstraints.HORIZONTAL, 189 new Insets(2, 5, 5, 5), 0, 0)); 190 panelUser.add(textName, 191 new GridBagConstraints(1, 0, 1, 1, 0.1, 0.0, 192 GridBagConstraints.WEST, 193 GridBagConstraints.HORIZONTAL, 194 new Insets(5, 5, 2, 5), 100, 0)); 195 panelUser.add(textWorking, 196 new GridBagConstraints(1, 1, 1, 1, 0.1, 0.0, 197 GridBagConstraints.WEST, 198 GridBagConstraints.HORIZONTAL, 199 new Insets(2, 5, 2, 5), 100, 0)); 200 panelUser.add(textHome, 201 new GridBagConstraints(1, 2, 1, 1, 0.1, 0.0, 202 GridBagConstraints.WEST, 203 GridBagConstraints.HORIZONTAL, 204 new Insets(2, 5, 5, 5), 0, 0)); 205 206 labelSystemName.setText("Operating system:"); 208 labelSystemArch.setText("Architecture:"); 209 textSystemName.setEditable(false); 210 textSystemName.setText("OPERATING SYSTEM"); 211 textSystemArch.setEditable(false); 212 textSystemArch.setText("ARCHITECHTURE"); 213 panelSystem.setLayout(layoutSystem); 214 panelSystem.setBorder(BorderFactory.createTitledBorder("System")); 215 panelSystem.add(labelSystemName, 216 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 217 GridBagConstraints.WEST, 218 GridBagConstraints.HORIZONTAL, 219 new Insets(5, 5, 2, 5), 0, 0)); 220 panelSystem.add(labelSystemArch, 221 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 222 GridBagConstraints.WEST, 223 GridBagConstraints.HORIZONTAL, 224 new Insets(2, 5, 5, 5), 0, 0)); 225 panelSystem.add(textSystemName, 226 new GridBagConstraints(1, 0, 1, 1, 0.1, 0.0, 227 GridBagConstraints.WEST, 228 GridBagConstraints.HORIZONTAL, 229 new Insets(5, 5, 2, 5), 100, 230 0)); 231 panelSystem.add(textSystemArch, 232 new GridBagConstraints(1, 1, 1, 1, 0.1, 0.0, 233 GridBagConstraints.WEST, 234 GridBagConstraints.HORIZONTAL, 235 new Insets(2, 5, 5, 5), 100, 236 0)); 237 238 panelJava.setLayout(layoutJava); 240 panelJava.setBorder(BorderFactory.createTitledBorder("Java")); 241 panelJava.add(labelJavaHome, 242 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 243 GridBagConstraints.WEST, 244 GridBagConstraints.HORIZONTAL, 245 new Insets(5, 5, 2, 5), 40, 0)); 246 panelJava.add(labelVendor, 247 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 248 GridBagConstraints.WEST, 249 GridBagConstraints.HORIZONTAL, 250 new Insets(2, 5, 2, 5), 0, 0)); 251 panelJava.add(labelVersion, 252 new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 253 GridBagConstraints.WEST, 254 GridBagConstraints.HORIZONTAL, 255 new Insets(2, 5, 5, 5), 0, 0)); 256 panelJava.add(textJavaHome, 257 new GridBagConstraints(1, 0, 1, 1, 0.1, 0.0, 258 GridBagConstraints.WEST, 259 GridBagConstraints.HORIZONTAL, 260 new Insets(5, 5, 2, 5), 100, 0)); 261 panelJava.add(textVendor, 262 new GridBagConstraints(1, 1, 1, 1, 0.1, 0.0, 263 GridBagConstraints.WEST, 264 GridBagConstraints.HORIZONTAL, 265 new Insets(2, 5, 2, 5), 100, 0)); 266 panelJava.add(textVersion, 267 new GridBagConstraints(1, 2, 1, 1, 0.1, 0.0, 268 GridBagConstraints.WEST, 269 GridBagConstraints.HORIZONTAL, 270 new Insets(2, 5, 5, 5), 100, 0)); 271 272 panelClassPath.setBorder(BorderFactory.createTitledBorder("Class Path")); 274 panelClassPath.setLayout(layoutClassPath); 275 textClassPath.setEditable(false); 276 textClassPath.setRows(5); 277 scrollClassPath = new JScrollPane(textClassPath); 278 panelClassPath.add(scrollClassPath, BorderLayout.CENTER); 279 280 this.setMaximumSize(new Dimension(600, 440)); 282 this.setMinimumSize(new Dimension(600, 440)); 283 this.setPreferredSize(new Dimension(600, 440)); 284 this.setLayout(layoutMain); 285 this.add(panelUser, 286 new GridBagConstraints(0, 0, 1, 1, 0.1, 0.1, 287 GridBagConstraints.CENTER, 288 GridBagConstraints.BOTH, 289 new Insets(5, 5, 2, 5), 0, 0)); 290 this.add(panelSystem, 291 new GridBagConstraints(0, 1, 1, 1, 0.1, 0.1, 292 GridBagConstraints.CENTER, 293 GridBagConstraints.BOTH, 294 new Insets(2, 5, 2, 5), 0, 0)); 295 this.add(panelJava, 296 new GridBagConstraints(0, 2, 1, 1, 0.1, 0.1, 297 GridBagConstraints.CENTER, 298 GridBagConstraints.BOTH, 299 new Insets(2, 5, 2, 5), 0, 0)); 300 this.add(panelClassPath, 301 new GridBagConstraints(0, 3, 1, 1, 0.1, 0.1, 302 GridBagConstraints.CENTER, 303 GridBagConstraints.BOTH, 304 new Insets(2, 5, 5, 5), 10, 60)); 305 } 306 307 } 308 | Popular Tags |