Skip to main content



      Home
Home » Archived » Visual Editor (VE) » tree cannot be painted in the VE
tree cannot be painted in the VE [message #607276] Sun, 01 May 2005 19:36
Eclipse UserFriend
Originally posted by: tischercd.hotmail.com

For create my tree and change the default code in
getJTree-Method: jTree = new JTree()
to the following: jTree = new JTree(rootNode);
the tree cannot be painted in the VISUAL EDITOR!

Can you explain this with code sample?

thanks

// Java Code
import javax.swing.JFrame;
import javax.swing.JTree;
import javax.swing.tree.*;


public class visual extends JFrame {

private javax.swing.JPanel jContentPane = null;
private JTree jTree = null;


private JTree getJTree() {
if (jTree == null) {
TreeNode rootNode = createNodes();
jTree = new JTree(rootNode);
}
return jTree;
}

private TreeNode createNodes() {
DefaultMutableTreeNode root;
DefaultMutableTreeNode grandparent;
DefaultMutableTreeNode parent;
DefaultMutableTreeNode child;

root = new DefaultMutableTreeNode("San Francisco");

grandparent = new DefaultMutableTreeNode("Potrero Hill");
root.add(grandparent);
parent = new DefaultMutableTreeNode("Restaurants");
grandparent.add(parent);
child = new DefaultMutableTreeNode("Thai Barbeque");
parent.add(child);
child = new DefaultMutableTreeNode("Goat Hill Pizza");
parent.add(child);

return root;
}

public static void main(String[] args) {
visual application = new visual();
application.show();
}

public visual() {
super();
initialize();
}


private void initialize() {
this.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLO SE);
this.setSize(300,200);
this.setContentPane(getJContentPane());
this.setTitle("Application");
}


private javax.swing.JPanel getJContentPane() {
if(jContentPane == null) {
jContentPane = new javax.swing.JPanel();
jContentPane.setLayout(new java.awt.BorderLayout());
jContentPane.add(getJTree(), java.awt.BorderLayout.CENTER);
}
return jContentPane;
}
}
Previous Topic:VE's behaviour when a VE visual class is instantiated from within another VE visual class
Next Topic:tree cannot be painted in the VE
Goto Forum:
  


Current Time: Sat Jun 21 05:00:03 EDT 2025

Powered by FUDForum. Page generated in 0.03795 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top