当前位置: 首页>>代码示例>>Java>>正文


Java BasicTreeUI类代码示例

本文整理汇总了Java中javax.swing.plaf.basic.BasicTreeUI的典型用法代码示例。如果您正苦于以下问题:Java BasicTreeUI类的具体用法?Java BasicTreeUI怎么用?Java BasicTreeUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BasicTreeUI类属于javax.swing.plaf.basic包,在下文中一共展示了BasicTreeUI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showPathWithoutExpansion

import javax.swing.plaf.basic.BasicTreeUI; //导入依赖的package包/类
/** 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);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:BeanTreeView.java

示例2: isLocationInExpandControl

import javax.swing.plaf.basic.BasicTreeUI; //导入依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:TreeTable.java

示例3: showPathWithoutExpansion

import javax.swing.plaf.basic.BasicTreeUI; //导入依赖的package包/类
/** 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);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:TemplatesPanelGUI.java

示例4: setUI

import javax.swing.plaf.basic.BasicTreeUI; //导入依赖的package包/类
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 {
        super.setUI(ui);
        
        // #269500 - performance workaround for BasicTreeUI
        if (!DISABLE_TREEUI_FIX && ui instanceof BasicTreeUI)
            workaroundVerticalLines = UIManager.getBoolean("Tree.paintLines"); // NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:ProfilerTreeTable.java

示例5: CheckboxTree

import javax.swing.plaf.basic.BasicTreeUI; //导入依赖的package包/类
/**
 * Constructs a tree, with cell renderer and editor set by
 * {@link #createRenderer()} and {@link #createEditor()}.
 */
public CheckboxTree() {
    setCellRenderer(createRenderer());
    setCellEditor(createEditor());
    setEditable(true);
    setRootVisible(false);
    setShowsRootHandles(true);
    // make sure the checkbox never selects the label
    // note that the BasicTreeUI may not be what is used in the current LAF,
    // but I don't know any other way to modify the selection behaviour
    BasicTreeUI ui = new BasicTreeUI() {
        @Override
        protected void selectPathForEvent(TreePath path, MouseEvent event) {
            if (!isOverCheckBox(path, event.getPoint().x)) {
                super.selectPathForEvent(path, event);
            }
        }
    };
    setUI(ui);
    // initialise the tree model
    this.topNode = new DefaultMutableTreeNode();
    this.treeModel = new DefaultTreeModel(this.topNode);
    setModel(this.treeModel);
    // set selection mode
    getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:30,代码来源:CheckboxTree.java

示例6: createRecordTree

import javax.swing.plaf.basic.BasicTreeUI; //导入依赖的package包/类
public void createRecordTree(){		
	model = new RecordTreeModel();
	this.setModel(model);		
	renderer = new RecordTreeCellRenderer();			
	renderer.setLeafIcon(null);
	renderer.setClosedIcon(null);
	renderer.setOpenIcon(null);		  
	this.setCellRenderer(renderer);
	renderer.setIcon(null);
	renderer.setOpenIcon(null);
	renderer.setClosedIcon(null);		
	editor = new RecordTreeCellEditor(this,renderer);		
	this.setCellEditor(editor);		    
	this.setEditable(true);
	this.setRootVisible(false);		
	this.putClientProperty("JTree.lineStyle", "None");
	((BasicTreeUI)this.getUI()).setCollapsedIcon(null);
	((BasicTreeUI)this.getUI()).setExpandedIcon(null);		
	this.setScrollsOnExpand(true);
	this.setExpandsSelectedPaths(true);	
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:22,代码来源:RecordTree.java

示例7: handleKeys

import javax.swing.plaf.basic.BasicTreeUI; //导入依赖的package包/类
private void handleKeys(Component comp,KeyEvent e){
  if(e.getKeyCode()==KeyEvent.VK_L && e.getModifiers()== InputEvent.CTRL_MASK)
    listiciButton.doClick();
  if(e.getKeyCode()==KeyEvent.VK_V && e.getModifiers()== InputEvent.CTRL_MASK)
    validateRecord.doClick();
  /*if(e.getKeyCode()==KeyEvent.VK_NUMPAD7)
    addUField.doClick();  */
  if(e.getKeyCode()==KeyEvent.VK_ESCAPE){
    if(comp.equals(zapisPanel.getRecordTree())){
      if(!((BasicTreeUI)zapisPanel.getRecordTree().getUI()).isEditing(zapisPanel.getRecordTree()))
        handleCloseEditor();
    }else
      handleCloseEditor();
  }
  if(e.getKeyCode()== KeyEvent.VK_S){
 	 saveRecord.doClick();
  }
  if(e.getKeyCode()==KeyEvent.VK_F6 
 		 && e.getModifiers()== InputEvent.CTRL_MASK){    	 
 	 BisisApp.getMainFrame().selectNextInternalFrame();
  }
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:23,代码来源:EditorFrame.java

示例8: clearRendererCache

import javax.swing.plaf.basic.BasicTreeUI; //导入依赖的package包/类
private void clearRendererCache() {
  // 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();
    for (int i = rowForLocation + visibleRowCount + 1; i >= rowForLocation; i--) {
      final TreePath eachPath = myTree.getPathForRow(i);
      if (eachPath == null) continue;

      treeState.invalidatePathBounds(eachPath);
    }
    myTree.repaint(visibleRect);
  }
  else {
    myTree.setCellRenderer(myUsageViewTreeCellRenderer);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:UsageViewImpl.java

示例9: isLocationInExpandControl

import javax.swing.plaf.basic.BasicTreeUI; //导入依赖的package包/类
private boolean isLocationInExpandControl(final TreePath path, final int x, final int y) {
  final TreeUI ui = getUI();
  if (!(ui instanceof BasicTreeUI)) return false;

  try {
    Class aClass = ui.getClass();
    while (BasicTreeUI.class.isAssignableFrom(aClass) && !BasicTreeUI.class.equals(aClass)) {
      aClass = aClass.getSuperclass();
    }
    final Method method = ReflectionUtil.getDeclaredMethod(aClass, "isLocationInExpandControl", TreePath.class, int.class, int.class);
    if (method != null) {
      return (Boolean)method.invoke(ui, path, x, y);
    }
  }
  catch (Throwable ignore) { }

  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:Tree.java

示例10: isLocationInExpandControl

import javax.swing.plaf.basic.BasicTreeUI; //导入依赖的package包/类
private boolean isLocationInExpandControl(final TreePath path, final int x, final int y) {
  final TreeUI ui = getUI();
  if (!(ui instanceof BasicTreeUI)) return false;

  try {
    Class aClass = ui.getClass();
    while (BasicTreeUI.class.isAssignableFrom(aClass) && !BasicTreeUI.class.equals(aClass)) {
      aClass = aClass.getSuperclass();
    }
    final Method method = ReflectionUtil.getDeclaredMethod(aClass, "isLocationInExpandControl", TreePath.class, int.class, int.class);
    if (method != null) {
      method.setAccessible(true);
      return (Boolean)method.invoke(ui, path, x, y);
    }
  }
  catch (Throwable ignore) { }

  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:Tree.java

示例11: clearRendererCache

import javax.swing.plaf.basic.BasicTreeUI; //导入依赖的package包/类
private void clearRendererCache() {
  ApplicationManager.getApplication().assertIsDispatchThread();
  if (expandingAll) 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();
    for (int i = rowForLocation + visibleRowCount + 1; i >= rowForLocation; i--) {
      final TreePath eachPath = myTree.getPathForRow(i);
      if (eachPath == null) continue;

      treeState.invalidatePathBounds(eachPath);
    }
    myTree.repaint(visibleRect);
  }
  else {
    myTree.setCellRenderer(myUsageViewTreeCellRenderer);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:UsageViewImpl.java

示例12: setTreeUIVariables

import javax.swing.plaf.basic.BasicTreeUI; //导入依赖的package包/类
private void setTreeUIVariables() {
    if (tree.getUI() instanceof BasicTreeUI) {
        BasicTreeUI treeUI = (BasicTreeUI) tree.getUI();
        treeSignExtent = treeUI.getExpandedIcon().getIconWidth() / 2;
        treeSignRightMargin = treeUI.getRightChildIndent();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:JTreeTable.java

示例13: clearDrawingCache

import javax.swing.plaf.basic.BasicTreeUI; //导入依赖的package包/类
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) {}
   }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:DebugTreeView.java

示例14: MyTreeTableCellRenderer

import javax.swing.plaf.basic.BasicTreeUI; //导入依赖的package包/类
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());
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:12,代码来源:MyTreeTableCellRenderer.java

示例15: testNPEAtActionsPage

import javax.swing.plaf.basic.BasicTreeUI; //导入依赖的package包/类
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, ""));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:bug8003830.java


注:本文中的javax.swing.plaf.basic.BasicTreeUI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。