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

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

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

JTree.getName介绍

暂无

代码示例

代码示例来源:origin: org.zaproxy/zap

private JTree getTree(Component invoker) {
  if (invoker instanceof JTree) {
    JTree tree = (JTree) invoker;
    if (tree.getName().equals("treeSite")) {
      return tree;
    }
  }
  return null;
}

代码示例来源:origin: org.zaproxy/zap

@Override
public boolean isEnableForComponent(Component invoker) {
  if (invoker instanceof JTree) {
    JTree tree = (JTree) invoker;
    if (tree.getName().equals("treeSite")) {
      this.setEnabled(true);
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.zaproxy/zap

@Override
  public void show(Component invoker, int x, int y) {
    final int countSelectedNodes = treeAlert.getSelectionCount();
    final ArrayList<HistoryReference> uniqueHistoryReferences = new ArrayList<>(countSelectedNodes);
    if (countSelectedNodes > 0) {
      SortedSet<Integer> historyReferenceIdsAdded = new TreeSet<>();
      for (TreePath path : treeAlert.getSelectionPaths()) {
        final AlertNode node = (AlertNode) path.getLastPathComponent();
        final Object userObject = node.getUserObject();
        if (userObject instanceof Alert) {
          HistoryReference historyReference = ((Alert) userObject).getHistoryRef();
          if (historyReference != null && !historyReferenceIdsAdded
              .contains(Integer.valueOf(historyReference.getHistoryId()))) {
            historyReferenceIdsAdded.add(Integer.valueOf(historyReference.getHistoryId()));
            uniqueHistoryReferences.add(historyReference);
          }
        }
      }
      uniqueHistoryReferences.trimToSize();
    }
    SelectableHistoryReferencesContainer messageContainer = new DefaultSelectableHistoryReferencesContainer(
        treeAlert.getName(),
        treeAlert,
        Collections.<HistoryReference> emptyList(),
        uniqueHistoryReferences);
    view.getPopupMenu().show(messageContainer, x, y);
  }
});

代码示例来源: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: org.zaproxy/zap

treeSite.getName(),
treeSite,
Collections.<HistoryReference> emptyList(),

相关文章

JTree类方法