1 26 27 package org.objectweb.util.browser.plugin.java; 28 29 import java.awt.Color ; 30 import java.util.Enumeration ; 31 import java.util.Properties ; 32 33 import javax.swing.BoxLayout ; 34 import javax.swing.JPanel ; 35 import javax.swing.JScrollPane ; 36 import javax.swing.JTable ; 37 38 import org.objectweb.util.browser.api.TreeView; 39 import org.objectweb.util.browser.api.Panel; 40 41 48 public class PropertiesPanel 49 implements Panel { 50 51 57 58 protected JPanel panel_; 59 60 66 69 public PropertiesPanel() { 70 panel_ = new JPanel (); 71 panel_.setBackground(Color.white); 72 panel_.setLayout(new BoxLayout (panel_, BoxLayout.Y_AXIS)); 73 } 74 75 81 87 90 public void selected(TreeView treeView) { 91 String [] titre = {"Keys","Values"}; 92 Properties properties = (Properties )treeView.getSelectedObject(); 93 Enumeration keys, elements; 94 keys = properties.keys(); 95 elements = properties.elements(); 96 String [][] contenu = new String [properties.size()][2]; 97 for (int i = 0; i < properties.size(); i++) { 98 contenu[i] = new String []{(String ) keys.nextElement(),(String )elements.nextElement()}; 99 } 100 panel_.add(new JScrollPane (new JTable (contenu,titre))); 101 } 102 103 106 public JPanel getPanel() { 107 return panel_; 108 } 109 110 114 public void unselected(TreeView treeview) { 115 } 117 118 } | Popular Tags |