类javax.swing.plaf.basic.BasicTreeUI源码实例Demo

下面列出了怎么用javax.swing.plaf.basic.BasicTreeUI的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: netbeans   文件: BeanTreeView.java
/** Make a path visible.
* @param path the path
*/
private void showPathWithoutExpansion(TreePath path) {
    Rectangle rect = tree.getPathBounds(path);
    if (rect != null) { //PENDING
        TreeUI tmp = tree.getUI();
        int correction = 0;
        if (tmp instanceof BasicTreeUI) {
            correction = ((BasicTreeUI) tmp).getLeftChildIndent();
            correction += ((BasicTreeUI) tmp).getRightChildIndent();
        }
        rect.x = Math.max(0, rect.x - correction);
        if (rect.y >= 0) { //#197514 - do not scroll to negative y values
            tree.scrollRectToVisible(rect);
        }
    }
}
 
源代码2 项目: netbeans   文件: TreeTable.java
private boolean isLocationInExpandControl( TreePath path, Point location ) {
   if( tree.getModel().isLeaf( path.getLastPathComponent() ) )
       return false;
   
   Rectangle r = tree.getPathBounds(path);
   int boxWidth = 8;
   Insets i = tree.getInsets();
   int indent = 0;
   
   if( tree.getUI() instanceof BasicTreeUI ) {
       BasicTreeUI ui = (BasicTreeUI)tree.getUI();
       if( null != ui.getExpandedIcon() )
           boxWidth = ui.getExpandedIcon().getIconWidth();
       
       indent = ui.getLeftChildIndent();
   }
   int boxX;
   if( tree.getComponentOrientation().isLeftToRight() ) {
       boxX = r.x - positionX - indent - boxWidth;
   } else {
       boxX = r.x - positionX + indent + r.width;
   }
   return location.getX() >= boxX && location.getX() <= (boxX + boxWidth);
}
 
源代码3 项目: netbeans   文件: TemplatesPanelGUI.java
/** Make a path visible.
* @param path the path
*/
private void showPathWithoutExpansion(TreePath path) {
    Rectangle rect = tree.getPathBounds(path);
    if (rect != null) { //PENDING
        TreeUI tmp = tree.getUI();
        int correction = 0;
        if (tmp instanceof BasicTreeUI) {
            correction = ((BasicTreeUI) tmp).getLeftChildIndent();
            correction += ((BasicTreeUI) tmp).getRightChildIndent();
        }
        rect.x = Math.max(0, rect.x - correction);
        rect.y += rect.height;
        if (rect.y >= 0) { //#197514 - do not scroll to negative y values
            tree.scrollRectToVisible(rect);
        }
    }
}
 
源代码4 项目: flutter-intellij   文件: InspectorTree.java
public InspectorTree(final DefaultMutableTreeNode treemodel,
                     String treeName,
                     boolean detailsSubtree,
                     String parentTreeName,
                     boolean rootVisible,
                     boolean legacyMode,
                     Disposable parentDisposable) {
  super(treemodel);
  setUI(new InspectorTreeUI());
  final BasicTreeUI ui = (BasicTreeUI)getUI();
  this.detailsSubtree = detailsSubtree;

  setRootVisible(rootVisible);
  getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  registerShortcuts(parentDisposable);
  if (detailsSubtree) {
    // TODO(devoncarew): This empty text is not showing up for the details area, even when there are no detail nodes.
    getEmptyText().setText(treeName + " subtree of the selected " + parentTreeName);
  }
  else {
    getEmptyText().setText(treeName + " tree for the running app");
  }
}
 
源代码5 项目: flutter-intellij   文件: InspectorTree.java
public InspectorTree(final DefaultMutableTreeNode treemodel,
                     String treeName,
                     boolean detailsSubtree,
                     String parentTreeName,
                     boolean rootVisible,
                     boolean legacyMode,
                     Disposable parentDisposable) {
  super(treemodel);
  setUI(new InspectorTreeUI());
  final BasicTreeUI ui = (BasicTreeUI)getUI();
  this.detailsSubtree = detailsSubtree;

  setRootVisible(rootVisible);
  getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  registerShortcuts(parentDisposable);
  if (detailsSubtree) {
    // TODO(devoncarew): This empty text is not showing up for the details area, even when there are no detail nodes.
    getEmptyText().setText(treeName + " subtree of the selected " + parentTreeName);
  }
  else {
    getEmptyText().setText(treeName + " tree for the running app");
  }
}
 
源代码6 项目: FlatLaf   文件: FlatTreeUI.java
@Override
protected PropertyChangeListener createPropertyChangeListener() {
	if( !wideSelection )
		return super.createPropertyChangeListener();

	return new BasicTreeUI.PropertyChangeHandler() {
		@Override
		public void propertyChange( PropertyChangeEvent e ) {
			super.propertyChange( e );

			if( e.getSource() == tree && e.getPropertyName() == "dropLocation" ) {
				JTree.DropLocation oldValue = (JTree.DropLocation) e.getOldValue();
				repaintWideDropLocation( oldValue );
				repaintWideDropLocation( tree.getDropLocation() );
			}
		}

		private void repaintWideDropLocation(JTree.DropLocation loc) {
			if( loc == null || isDropLine( loc ) )
				return;

			Rectangle r = tree.getPathBounds( loc.getPath() );
			if( r != null )
				tree.repaint( 0, r.y, tree.getWidth(), r.height );
		}
	};
}
 
源代码7 项目: dragonwell8_jdk   文件: bug8003830.java
public void testNPEAtActionsPage() {
    JTree tree = new JTree();
    BasicTreeUI ui = new NullReturningTreeUI();
    tree.setUI(ui);
    BasicTreeUI.TreePageAction tpa = ui.new TreePageAction(0, "down");
    tpa.actionPerformed(new ActionEvent(tree, 0, ""));
}
 
源代码8 项目: TencentKona-8   文件: bug8003830.java
public void testNPEAtActionsPage() {
    JTree tree = new JTree();
    BasicTreeUI ui = new NullReturningTreeUI();
    tree.setUI(ui);
    BasicTreeUI.TreePageAction tpa = ui.new TreePageAction(0, "down");
    tpa.actionPerformed(new ActionEvent(tree, 0, ""));
}
 
源代码9 项目: jdk8u60   文件: bug8003830.java
public void testNPEAtActionsPage() {
    JTree tree = new JTree();
    BasicTreeUI ui = new NullReturningTreeUI();
    tree.setUI(ui);
    BasicTreeUI.TreePageAction tpa = ui.new TreePageAction(0, "down");
    tpa.actionPerformed(new ActionEvent(tree, 0, ""));
}
 
源代码10 项目: openjdk-jdk8u   文件: bug8003830.java
public void testNPEAtActionsPage() {
    JTree tree = new JTree();
    BasicTreeUI ui = new NullReturningTreeUI();
    tree.setUI(ui);
    BasicTreeUI.TreePageAction tpa = ui.new TreePageAction(0, "down");
    tpa.actionPerformed(new ActionEvent(tree, 0, ""));
}
 
源代码11 项目: netbeans   文件: ProfilerTreeTable.java
public void setUI(TreeUI ui) {
            if (ui instanceof SynthTreeUI) {
//                if (synthLikeUI == null) {
                    super.setUI(ui);
                    SynthTreeUI synthUI = (SynthTreeUI)ui;
                    int left = synthUI.getLeftChildIndent();
                    int right = synthUI.getRightChildIndent();

                    synthLikeUI = new SynthLikeTreeUI();
                    super.setUI(synthLikeUI);

                    boolean nimbus = UIUtils.isNimbusLookAndFeel();
                    synthLikeUI.setLeftChildIndent(left + (nimbus ? 4 : 6));
                    synthLikeUI.setRightChildIndent(right);
//                } else {
//                    super.setUI(synthLikeUI);
//                }
            } else {
                synthLikeUI = null;
                
                super.setUI(ui);
                
                // #269500 - performance workaround for BasicTreeUI
                if (!DISABLE_TREEUI_FIX && ui instanceof BasicTreeUI)
                    workaroundVerticalLines = UIManager.getBoolean("Tree.paintLines"); // NOI18N
            }
        }
 
源代码12 项目: netbeans   文件: JTreeTable.java
private void setTreeUIVariables() {
    if (tree.getUI() instanceof BasicTreeUI) {
        BasicTreeUI treeUI = (BasicTreeUI) tree.getUI();
        treeSignExtent = treeUI.getExpandedIcon().getIconWidth() / 2;
        treeSignRightMargin = treeUI.getRightChildIndent();
    }
}
 
源代码13 项目: netbeans   文件: DebugTreeView.java
private static void clearDrawingCache(JTree tree) {
   TreeUI tui = tree.getUI();
   if (tui instanceof BasicTreeUI) {
       try {
           Field drawingCacheField = BasicTreeUI.class.getDeclaredField("drawingCache");
           drawingCacheField.setAccessible(true);
           Map table = (Map) drawingCacheField.get(tui);
           table.clear();
       } catch (Exception ex) {}
   }
}
 
源代码14 项目: openjdk-jdk8u-backup   文件: bug8003830.java
public void testNPEAtActionsPage() {
    JTree tree = new JTree();
    BasicTreeUI ui = new NullReturningTreeUI();
    tree.setUI(ui);
    BasicTreeUI.TreePageAction tpa = ui.new TreePageAction(0, "down");
    tpa.actionPerformed(new ActionEvent(tree, 0, ""));
}
 
源代码15 项目: openjdk-jdk9   文件: bug8003830.java
public void testNPEAtActionsPage() {
    JTree tree = new JTree();
    BasicTreeUI ui = new NullReturningTreeUI();
    tree.setUI(ui);
    BasicTreeUI.TreePageAction tpa = ui.new TreePageAction(0, "down");
    tpa.actionPerformed(new ActionEvent(tree, 0, ""));
}
 
源代码16 项目: jdk8u-jdk   文件: bug8003830.java
public void testNPEAtActionsPage() {
    JTree tree = new JTree();
    BasicTreeUI ui = new NullReturningTreeUI();
    tree.setUI(ui);
    BasicTreeUI.TreePageAction tpa = ui.new TreePageAction(0, "down");
    tpa.actionPerformed(new ActionEvent(tree, 0, ""));
}
 
源代码17 项目: hottub   文件: bug8003830.java
public void testNPEAtActionsPage() {
    JTree tree = new JTree();
    BasicTreeUI ui = new NullReturningTreeUI();
    tree.setUI(ui);
    BasicTreeUI.TreePageAction tpa = ui.new TreePageAction(0, "down");
    tpa.actionPerformed(new ActionEvent(tree, 0, ""));
}
 
源代码18 项目: openjdk-8-source   文件: bug8003830.java
public void testNPEAtActionsPage() {
    JTree tree = new JTree();
    BasicTreeUI ui = new NullReturningTreeUI();
    tree.setUI(ui);
    BasicTreeUI.TreePageAction tpa = ui.new TreePageAction(0, "down");
    tpa.actionPerformed(new ActionEvent(tree, 0, ""));
}
 
源代码19 项目: visualvm   文件: ProfilerTreeTable.java
public void setUI(TreeUI ui) {
            if (ui instanceof SynthTreeUI) {
//                if (synthLikeUI == null) {
                    super.setUI(ui);
                    SynthTreeUI synthUI = (SynthTreeUI)ui;
                    int left = synthUI.getLeftChildIndent();
                    int right = synthUI.getRightChildIndent();

                    synthLikeUI = new SynthLikeTreeUI();
                    super.setUI(synthLikeUI);

                    boolean nimbus = UIUtils.isNimbusLookAndFeel();
                    synthLikeUI.setLeftChildIndent(left + (nimbus ? 4 : 6));
                    synthLikeUI.setRightChildIndent(right);
//                } else {
//                    super.setUI(synthLikeUI);
//                }
            } else {
                synthLikeUI = null;
                
                super.setUI(ui);
                
                // #269500 - performance workaround for BasicTreeUI
                if (!DISABLE_TREEUI_FIX && ui instanceof BasicTreeUI)
                    workaroundVerticalLines = UIManager.getBoolean("Tree.paintLines"); // NOI18N
            }
        }
 
源代码20 项目: visualvm   文件: JTreeTable.java
private void setTreeUIVariables() {
    if (tree.getUI() instanceof BasicTreeUI) {
        BasicTreeUI treeUI = (BasicTreeUI) tree.getUI();
        treeSignExtent = treeUI.getExpandedIcon().getIconWidth() / 2;
        treeSignRightMargin = treeUI.getRightChildIndent();
    }
}
 
源代码21 项目: openjdk-8   文件: bug8003830.java
public void testNPEAtActionsPage() {
    JTree tree = new JTree();
    BasicTreeUI ui = new NullReturningTreeUI();
    tree.setUI(ui);
    BasicTreeUI.TreePageAction tpa = ui.new TreePageAction(0, "down");
    tpa.actionPerformed(new ActionEvent(tree, 0, ""));
}
 
源代码22 项目: jdk8u_jdk   文件: bug8003830.java
public void testNPEAtActionsPage() {
    JTree tree = new JTree();
    BasicTreeUI ui = new NullReturningTreeUI();
    tree.setUI(ui);
    BasicTreeUI.TreePageAction tpa = ui.new TreePageAction(0, "down");
    tpa.actionPerformed(new ActionEvent(tree, 0, ""));
}
 
源代码23 项目: jdk8u-jdk   文件: bug8003830.java
public void testNPEAtActionsPage() {
    JTree tree = new JTree();
    BasicTreeUI ui = new NullReturningTreeUI();
    tree.setUI(ui);
    BasicTreeUI.TreePageAction tpa = ui.new TreePageAction(0, "down");
    tpa.actionPerformed(new ActionEvent(tree, 0, ""));
}
 
源代码24 项目: jdk8u-dev-jdk   文件: bug8003830.java
public void testNPEAtActionsPage() {
    JTree tree = new JTree();
    BasicTreeUI ui = new NullReturningTreeUI();
    tree.setUI(ui);
    BasicTreeUI.TreePageAction tpa = ui.new TreePageAction(0, "down");
    tpa.actionPerformed(new ActionEvent(tree, 0, ""));
}
 
源代码25 项目: jpexs-decompiler   文件: GenericTagTreePanel.java
public MyTree() {
    setBackground(Color.white);
    setUI(new BasicTreeUI() {
        @Override
        public void paint(Graphics g, JComponent c) {
            setHashColor(Color.gray);
            super.paint(g, c);
        }
    });
    setCellRenderer(new MyTreeCellRenderer());
    setCellEditor(new MyTreeCellEditor(this));
    setInvokesStopCellEditing(true);

}
 
源代码26 项目: jpexs-decompiler   文件: TagTree.java
public TagTree(TagTreeModel treeModel, MainPanel mainPanel) {
    super(treeModel);
    this.mainPanel = mainPanel;
    setCellRenderer(new TagTreeCellRenderer());
    setRootVisible(false);
    setBackground(Color.white);
    setRowHeight(Math.max(getFont().getSize() + 5, 16));
    setLargeModel(true);
    setUI(new BasicTreeUI() {
        {
            setHashColor(Color.gray);
        }
    });
}
 
源代码27 项目: jpexs-decompiler   文件: DumpTree.java
public DumpTree(DumpTreeModel treeModel, MainPanel mainPanel) {
    super(treeModel);
    this.mainPanel = mainPanel;
    setCellRenderer(new DumpTreeCellRenderer());
    setRootVisible(false);
    setBackground(Color.white);
    setUI(new BasicTreeUI() {
        {
            setHashColor(Color.gray);
        }
    });
}
 
源代码28 项目: jpexs-decompiler   文件: MyTreeTableCellRenderer.java
public MyTreeTableCellRenderer(MyTreeTable treeTable, TreeModel model) {
    super(model);
    setUI(new BasicTreeUI());

    this.treeTable = treeTable;

    // Setzen der Zeilenhoehe fuer die JTable
    // Muss explizit aufgerufen werden, weil treeTable noch
    // null ist, wenn super(model) setRowHeight aufruft!
    setRowHeight(getRowHeight());
}
 
源代码29 项目: consulo   文件: UsageViewImpl.java
private void clearRendererCache() {
  ApplicationManager.getApplication().assertIsDispatchThread();
  if (myExpandingCollapsing) return; // to avoid quadratic row enumeration
  // clear renderer cache of node preferred size
  TreeUI ui = myTree.getUI();
  if (ui instanceof BasicTreeUI) {
    AbstractLayoutCache treeState = ReflectionUtil.getField(BasicTreeUI.class, ui, AbstractLayoutCache.class, "treeState");
    Rectangle visibleRect = myTree.getVisibleRect();
    int rowForLocation = myTree.getClosestRowForLocation(0, visibleRect.y);
    int visibleRowCount = getVisibleRowCount();
    List<Node> toUpdate = new ArrayList<>();
    for (int i = rowForLocation + visibleRowCount + 1; i >= rowForLocation; i--) {
      final TreePath eachPath = myTree.getPathForRow(i);
      if (eachPath == null) continue;

      treeState.invalidatePathBounds(eachPath);
      Object node = eachPath.getLastPathComponent();
      if (node instanceof UsageNode) {
        toUpdate.add((Node)node);
      }
    }
    queueUpdateBulk(toUpdate, () -> {
      if (!isDisposed()) {
        myTree.repaint(visibleRect);
      }
    });
  }
  else {
    myTree.setCellRenderer(myUsageViewTreeCellRenderer);
  }
}
 
源代码30 项目: consulo   文件: SimpleTree.java
private static int getBoxWidth(JTree tree) {
  BasicTreeUI basicTreeUI = (BasicTreeUI)tree.getUI();
  int boxWidth;
  if (basicTreeUI.getExpandedIcon() != null) {
    boxWidth = basicTreeUI.getExpandedIcon().getIconWidth();
  }
  else {
    boxWidth = 8;
  }
  return boxWidth;
}
 
 类所在包
 同包方法