new JTree() : JTree « javax.swing « Java by API






new JTree()

  
import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTree;

public class MainClass {
  public static void main(String args[]) {
    JFrame f = new JFrame("JTree Sample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JTree tree = new JTree();
    JScrollPane scrollPane = new JScrollPane(tree);
    f.add(scrollPane, BorderLayout.CENTER);
    f.setSize(300, 200);
    f.setVisible(true);
  }
}

           
         
    
  








Related examples in the same category

1.Tree.closedIcon
2.Tree.collapsedIcon
3.Tree.expandedIcon
4.Tree.leafIcon
5.Tree.openIcon
6.JTree.DynamicUtilTreeNode: createChildren(DefaultMutableTreeNode parent, Object children)
7.new JTree(TreeNode root)
8.new JTree(Vector vector)
9.JTree: addTreeSelectionListener(TreeSelectionListener tsl)
10.JTree: addTreeWillExpandListener(TreeWillExpandListener tel)
11.JTree: convertValueToText(Object v,boolean s,boolean e,boolean l,int r,boolean h)
12.JTree: getCellRenderer()
13.JTree: getLeadSelectionRow()
14.JTree: getMaxSelectionRow()
15.JTree: getMinSelectionRow()
16.JTree: getNextMatch(String prefix, int startingRow, Bias bias)
17.JTree: getPathForLocation(int x, int y)
18.JTree: getRowHeight()
19.JTree: getSelectionRows()
20.JTree: putClientProperty('JTree.lineStyle', 'None')
21.JTree: setAutoscrolls(boolean b)
22.JTree: setCellEditor(TreeCellEditor editor)
23.JTree: setExpandedState(TreePath path, boolean state)
24.JTree: setRowHeight(int rowHeight)
25.JTree: setTransferHandler(TransferHandler newHandler) (Drag and drop files from file explore)