JTable
component by allowing to:JComponents
managed by the ExtendedCellEditor
classsetVisible
methodString[] fill_values = { "NONE", "HORIZONTAL", "VERTICAL VALUE", "BOTH" }; JComboBox cb = new JComboBox(fill_values); cb.setSelectedItem("VERTICAL VALUE"); JTextField tf = new JTextField("2"); JButton bo = new JButton("1"); JComboBox cb2 = new JComboBox(fill_values); cb2.setSelectedItem("VERTICAL VALUE"); JListChooser.ListChooserHandler handler = new JListChooser.ListChooserHandler() { @Override public Object getCurrentValue(JComponent c) { JComboBox cb = (JComboBox) c; return cb.getSelectedItem(); } }; JListChooser lc = new JListChooser(cb2, handler); lc.setTitle("test"); JListSelector ls = new JListSelector(lc); JFileSelector fs = new JFileSelector("tata"); JFileSelector fs2 = new JFileSelector(); JColorSelector cs = new JColorSelector(); cs.setColor(Color.RED); cb.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { System.out.println("comboBox changed "); } }); cs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { System.out.println("color changed "); } }); ls.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { System.out.println("List changed "); } }); PropertyEditor p = new PropertyEditor(); p.addProperty(cb, "VERTICAL VALUE", "combo box"); p.addProperty(tf, "2", "text"); p.addProperty(bo, "1", "button"); p.addProperty(fs, "", "file 1"); p.addProperty(fs2, "", "file 2"); p.addProperty(cs, "", "Color"); p.addProperty(ls, "", "List"); p.setVisible(true); JFrame f = new JFrame("test"); f.setSize(300, 300); f.getContentPane().add(p, BorderLayout.CENTER); f.setVisible(true);Result:
PropertyEditor p1 = new PropertyEditor(); JTextField tf = new JTextField("1"); p1.addProperty(tf,"1","prop 1"); p1.setVisible(true); PropertyEditor p2 = new PropertyEditor(); JTextField tf2 = new JTextField("2"); p2.addProperty(tf2,"2","prop 2"); p2.setVisible(true);
JPropertyTreePanel panel = new JPropertyTreePanel();
panel.addPropertyListNode(panel.getRootNode(), "node 1", p1); DefaultMutableTreeNode node = panel.addEmptyNode(panel.getRootNode(), "sub-node"); panel.addPropertyListNode(node, "node 2", p2);
PropertyEditor p1 = new PropertyEditor(); JTextField tf = new JTextField("1"); p1.addProperty(tf,"1","prop 1"); p1.setVisible(true); PropertyEditor p2 = new PropertyEditor(); JTextField tf2 = new JTextField("2"); p2.addProperty(tf2,"2","prop 2"); p2.setVisible(true); JPropertyTreePanel panel = new JPropertyTreePanel(); panel.addPropertyListNode(panel.getRootNode(), "node 1", p1); DefaultMutableTreeNode node = panel.addEmptyNode(panel.getRootNode(), "sub-node"); panel.addPropertyListNode(node, "node 2", p2); JFrame f = new JFrame("test"); f.setSize(300, 300); f.getContentPane().add(p, BorderLayout.CENTER); f.setVisible(true);Result:
JTable
cells.Copyright 2006-2024 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences