當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。