Re: How to edit node's name in tree table?
In article
<ea7811fa-ea2c-4d18-aab2-d50d1c54e908@y10g2000prc.googlegroups.com>,
oren7651@gmail.com wrote:
[...]
(I want to draw tree with no symbols)
<code>
package news;
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.HeadlessException;
import javax.swing.Icon;
import javax.swing.JFrame;
import javax.swing.JTree;
import javax.swing.UIManager;
public class JTreeLite {
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
createGUI();
}
});
}
private static void createGUI() throws HeadlessException {
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Icon empty = new TreeIcon();
UIManager.put("Tree.closedIcon", empty);
UIManager.put("Tree.openIcon", empty);
UIManager.put("Tree.collapsedIcon", empty);
UIManager.put("Tree.expandedIcon", empty);
UIManager.put("Tree.leafIcon", empty);
JTree jt = new JTree();
frame.add(jt);
frame.pack();
frame.setSize(300, 400);
frame.setVisible(true);
}
}
class TreeIcon implements Icon {
private static int SIZE = 0;
public TreeIcon() {}
@Override
public int getIconWidth() { return SIZE; }
@Override
public int getIconHeight() { return SIZE; }
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {}
}
</code>
--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>