javax.swing.JTree.isEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(132)

本文整理了Java中javax.swing.JTree.isEnabled()方法的一些代码示例,展示了JTree.isEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.isEnabled()方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:isEnabled

JTree.isEnabled介绍

暂无

代码示例

代码示例来源:origin: com.github.insubstantial/substance

@Override
public void mouseEntered(MouseEvent e) {
  if (!tree.isEnabled())
    return;
  // isInside = true;
}

代码示例来源:origin: org.java.net.substance/substance

public void mouseEntered(MouseEvent e) {
  if (!tree.isEnabled())
    return;
  // isInside = true;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Is the tree enabled
   *  @return boolean
   */
  public boolean isEnabled () {
    if (this.tree == null) {
      // E.g. in JDK 1.5 w/ GTK L&F, may be called from TreeView's
      // super (JScrollPane) constructor, so tree is uninitialized
      return true;
    }
    return this.tree.isEnabled();
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Is the tree enabled
   *  @return boolean
   */
  public boolean isEnabled () {
    if (this.tree == null) {
      // E.g. in JDK 1.5 w/ GTK L&F, may be called from TreeView's
      // super (JScrollPane) constructor, so tree is uninitialized
      return true;
    }
    return this.tree.isEnabled();
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

/** Is the tree enabled
   *  @return boolean
   */
  @Override
  public boolean isEnabled() {
    if (this.tree == null) {
      // E.g. in JDK 1.5 w/ GTK L&F, may be called from TreeView's
      // super (JScrollPane) constructor, so tree is uninitialized
      return true;
    }

    return this.tree.isEnabled();
  }
}

代码示例来源:origin: org.java.net.substance/substance

public void mouseExited(MouseEvent e) {
  if (!tree.isEnabled())
    return;
  // isInside = false;
  this.fadeOut();
  // System.out.println("Nulling RO index");
  currRolloverPathId = null;
}

代码示例来源:origin: com.github.insubstantial/substance

@Override
public void mouseExited(MouseEvent e) {
  if (!tree.isEnabled())
    return;
  // isInside = false;
  this.fadeOut();
  // System.out.println("Nulling RO index");
  currRolloverPathId = null;
}

代码示例来源:origin: com.github.insubstantial/substance

@Override
public void mouseMoved(MouseEvent e) {
  if (!tree.isEnabled())
    return;
  // isInside = true;
  handleMove(e);
}

代码示例来源:origin: org.java.net.substance/substance

public void mouseMoved(MouseEvent e) {
  if (!tree.isEnabled())
    return;
  // isInside = true;
  handleMove(e);
}

代码示例来源:origin: org.java.net.substance/substance

public void mouseDragged(MouseEvent e) {
  if (!tree.isEnabled())
    return;
  handleMove(e);
}

代码示例来源:origin: com.github.insubstantial/substance

@Override
public void mouseDragged(MouseEvent e) {
  if (!tree.isEnabled())
    return;
  handleMove(e);
}

代码示例来源:origin: khuxtable/seaglass

@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row,
  boolean hasFocus) {
  if (!useTreeColors && (sel || hasFocus)) {
    SeaGlassLookAndFeel.setSelectedUI((SynthLabelUI) SeaGlassLookAndFeel.getUIOfType(getUI(), SynthLabelUI.class), sel, hasFocus,
      tree.isEnabled(), false);
  } else {
    SeaGlassLookAndFeel.resetSelectedUI();
  }
  return super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}

代码示例来源:origin: org.cytoscape/cpath2-impl

/**
   * Gets the Tree Cell Renderer.
   * @param tree          JTree Object.
   * @param value         Object value.
   * @param isSelected    Node is selected.
   * @param expanded      Node is expanded.
   * @param leaf          Node is a leaf.
   * @param row           Row number.
   * @param hasFocus      Node has focus.
   * @return Custom Component.
   */
  public Component getTreeCellRendererComponent(JTree tree, Object value,
      boolean isSelected, boolean expanded,
      boolean leaf, int row, boolean hasFocus) {
    String stringValue = tree.convertValueToText(value, isSelected,
        expanded, leaf, row, hasFocus);
    CustomNodePanel customNodePanel = new CustomNodePanel(tree, value,
        expanded, leaf, stringValue);
    customNodePanel.setEnabled(tree.isEnabled());
    return customNodePanel;
  }
}

代码示例来源:origin: joel-costigliola/assertj-swing

/**
 * Returns the {@code String} representation of the given {@code Component}, which should be a {@code JTree} (or
 * subclass).
 *
 * @param c the given {@code Component}.
 * @return the {@code String} representation of the given {@code JTree}.
 */
@Override
@Nonnull protected String doFormat(@Nonnull Component c) {
 JTree tree = (JTree) c;
 String format = "%s[name=%s, selectionCount=%d, selectionPaths=%s, selectionMode=%s, enabled=%b, visible=%b, showing=%b";
 return String.format(format, getRealClassName(c), quote(tree.getName()), tree.getSelectionCount(),
            Arrays.format(selectionPaths(tree)), selectionMode(tree), tree.isEnabled(), tree.isVisible(),
            tree.isShowing());
}

代码示例来源:origin: RPTools/maptool

public Component getTreeCellRendererComponent(JTree tree, Object value,
    boolean sel, boolean expanded, boolean leaf, int row,
    boolean hasFocus) {
  node = (DefaultMutableTreeNode) value;
  mtnode = (MaptoolNode) node.getUserObject();
  setText(mtnode.toString());
  setBackground(tree.getBackground());
  setEnabled(tree.isEnabled());
  setComponentOrientation(tree.getComponentOrientation());
  return this;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-mobility-svgcore

public Component getTreeCellRendererComponent(JTree tree, Object value,
    boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  SVGNavigatorNode tna      = (SVGNavigatorNode)value;
  DocumentElement  de       = (DocumentElement)tna.getDocumentElement();        
  String           htmlText = tna.getText(true);
  Component        comp     = renderer.getTreeCellRendererComponent(tree, htmlText, sel, expanded, leaf, row, hasFocus);
  
  comp.setEnabled(tree.isEnabled());
  ((JLabel)comp).setToolTipText(tna.getToolTipText().trim().length() > 0 ? tna.getToolTipText() : null);
  
  boolean containsError = tna.getChildrenErrorCount() > 0;
  
  if ( tna.getNodeVisibility() == SVGNavigatorTree.VISIBILITY_UNDIRECT) {
    setIcon( TAG_GRAY_ICON, containsError);
  } else {
    //normal icons
    if( SVGNavigatorTree.isTreeElement(de)) {
      if (SVGFileModel.isAnimation(de)) {
        setIcon(ANIMATE_TAG_ICON, containsError);
      } else {
        setIcon(TAG_ICON, containsError);
      }
    }          
  }
  
  return comp;
}

代码示例来源:origin: org.icepdf.os/icepdf-viewer

public Component getTreeCellRendererComponent(JTree tree, Object value,
                       boolean isSelected, boolean expanded,
                       boolean leaf, int row, boolean hasFocus) {
  String stringValue = tree.convertValueToText(value, isSelected,
      expanded, leaf, row, hasFocus);
  setEnabled(tree.isEnabled());
  if (value instanceof LayersTreeNode) {
    checkBox.setSelected(((LayersTreeNode) value).isSelected());
  }
  treeLabel.setFont(tree.getFont());
  treeLabel.setText(stringValue);
  treeLabel.setSelected(isSelected);
  treeLabel.setFocus(hasFocus);
  return this;
}

代码示例来源:origin: org.n52.wps/52n-wps-install-wizard

public Component getTreeCellRendererComponent(JTree tree, Object value,
       boolean isSelected, boolean expanded,
       boolean leaf, int row, boolean hasFocus) {
 String  stringValue = tree.convertValueToText(value, isSelected,
     expanded, leaf, row, hasFocus);
 setEnabled(tree.isEnabled());
 check.setSelected(((CheckNode)value).isSelected());
 label.setFont(tree.getFont());
 label.setText(stringValue);
 label.setSelected(isSelected);
 label.setFocus(hasFocus);
 if (leaf) {
  label.setIcon(UIManager.getIcon("Tree.leafIcon"));
 } else if (expanded) {
  label.setIcon(UIManager.getIcon("Tree.openIcon"));
 } else {
  label.setIcon(UIManager.getIcon("Tree.closedIcon"));
 }        
 return this;
}

代码示例来源:origin: igniterealtime/Spark

public Component getTreeCellRendererComponent(JTree tree, Object value,
                       boolean isSelected, boolean expanded,
                       boolean leaf, int row, boolean hasFocus) {
  String stringValue = tree.convertValueToText(value, isSelected,
    expanded, leaf, row, hasFocus);
  setEnabled(tree.isEnabled());
  check.setSelected(((CheckNode)value).isSelected());
  label.setFont(tree.getFont());
  label.setText(stringValue);
  label.setSelected(isSelected);
  label.setFocus(hasFocus);
  if (leaf) {
    Icon icon = ((CheckNode)value).getIcon();
    label.setIcon(icon);
  }
  else if (expanded) {
    label.setIcon(UIManager.getIcon("Tree.openIcon"));
  }
  else {
    label.setIcon(UIManager.getIcon("Tree.closedIcon"));
  }
  return this;
}

代码示例来源:origin: Vhati/Slipstream-Mod-Manager

@Override
public Component getTreeCellRendererComponent( JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus ) {
  this.removeAll();
  checkbox.setState( TristateState.DESELECTED );
  Component delegateComp = delegate.getTreeCellRendererComponent( tree, value, sel, expanded, leaf, row, hasFocus );
  TreePath path = tree.getPathForRow( row );
  if ( path != null ) {
    if ( selectionModel.isPathSelected( path, selectionModel.isDigged() ) ) {
      checkbox.setState( TristateState.SELECTED );
    } else {
      checkbox.setState( ( selectionModel.isDigged() && selectionModel.isPartiallySelected( path ) ) ? TristateState.INDETERMINATE : TristateState.DESELECTED );
    }
  }
  checkbox.setVisible( path == null || checklistFilter == null || checklistFilter.isSelectable( path ) );
  checkbox.setEnabled( tree.isEnabled() );
  this.add( checkbox, BorderLayout.WEST );
  this.add( delegateComp, BorderLayout.CENTER );
  return this;
}

相关文章

JTree类方法