List of usage examples for javax.swing JTree setAutoscrolls
@BeanProperty(bound = false, expert = true, description = "Determines if this component automatically scrolls its contents when dragged.") public void setAutoscrolls(boolean autoscrolls)
autoscrolls
property. From source file:MainClass.java
public static void main(String args[]) { JFrame frame = new JFrame("Tree Lines"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Box box = Box.createHorizontalBox(); JTree tree1 = new JTree(); JScrollPane scrollPane1 = new JScrollPane(tree1); tree1.setAutoscrolls(true); JTree tree2 = new JTree(); tree2.putClientProperty("JTree.lineStyle", "None"); JScrollPane scrollPane2 = new JScrollPane(tree2); box.add(scrollPane1, BorderLayout.WEST); box.add(scrollPane2, BorderLayout.EAST); frame.add(box, BorderLayout.CENTER); frame.setSize(300, 240);//w ww .ja v a 2 s. co m frame.setVisible(true); }
From source file:TreeLines.java
public static void main(String args[]) { JFrame frame = new JFrame("Tree Lines"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container content = frame.getContentPane(); Box box = Box.createHorizontalBox(); JTree tree1 = new JTree(); tree1.putClientProperty("JTree.lineStyle", "Angled"); JScrollPane scrollPane1 = new JScrollPane(tree1); tree1.setAutoscrolls(true); JTree tree2 = new JTree(); JScrollPane scrollPane2 = new JScrollPane(tree2); box.add(scrollPane1, BorderLayout.WEST); box.add(scrollPane2, BorderLayout.EAST); frame.getContentPane().add(box, BorderLayout.CENTER); frame.setSize(300, 240);//from www. j a v a 2 s . c o m frame.setVisible(true); }
From source file:JTreeUtil.java
public static void configureDragAndDrop(JTree tree, JTreeDragController controller) { tree.setAutoscrolls(true); new TreeTransferHandler(tree, controller, DnDConstants.ACTION_COPY_OR_MOVE, true); }