1 26 27 package org.objectweb.util.explorer.plugin.java.swing; 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.explorer.api.Panel; 39 import org.objectweb.util.explorer.api.TreeView; 40 41 42 49 public class PropertiesPanel 50 implements Panel { 51 52 58 59 protected JPanel panel_; 60 61 67 70 public PropertiesPanel() { 71 panel_ = new JPanel (); 72 panel_.setBackground(Color.white); 73 panel_.setLayout(new BoxLayout (panel_, BoxLayout.Y_AXIS)); 74 } 75 76 82 88 91 public void selected(TreeView treeView) { 92 String [] titre = {"Keys","Values"}; 93 Properties properties = (Properties )treeView.getSelectedObject(); 94 Enumeration keys, elements; 95 keys = properties.keys(); 96 elements = properties.elements(); 97 String [][] contenu = new String [properties.size()][2]; 98 for (int i = 0; i < properties.size(); i++) { 99 contenu[i] = new String []{(String ) keys.nextElement(),(String )elements.nextElement()}; 100 } 101 panel_.add(new JScrollPane (new JTable (contenu,titre))); 102 } 103 104 107 public Object getPanel() { 108 return panel_; 109 } 110 111 114 public void unselected(TreeView treeview) { 115 } 117 118 } | Popular Tags |