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


Java DefaultTreeCellRenderer.setIcon方法代码示例

本文整理汇总了Java中javax.swing.tree.DefaultTreeCellRenderer.setIcon方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultTreeCellRenderer.setIcon方法的具体用法?Java DefaultTreeCellRenderer.setIcon怎么用?Java DefaultTreeCellRenderer.setIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.tree.DefaultTreeCellRenderer的用法示例。


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

示例1: setupForChart

import javax.swing.tree.DefaultTreeCellRenderer; //导入方法依赖的package包/类
private void setupForChart(DefaultTreeCellRenderer r, Chart chart) {
    ChartType chartType = chart.getType();
    if (chartType == null) {
        r.setIcon(CHART_ICON);
    } else if (chartType.equals(ChartType.BAR)) {
        r.setIcon(CHART_BAR_ICON);
    } else if (chartType.equals(ChartType.PIE)) {
        r.setIcon(CHART_PIE_ICON);
    } else if (chartType.equals(ChartType.CATEGORY_LINE)) {
        r.setIcon(CHART_LINE_ICON);
    } else if (chartType.equals(ChartType.SCATTER)) {
        r.setIcon(CHART_SCATTER_ICON);
    } else if (chartType.equals(ChartType.LINE)) {
        r.setIcon(CHART_LINE_ICON);
    } else {
        logger.warn("Using generic icon for unknown chart type " + chartType);
        r.setIcon(CHART_ICON); 
    }
    r.setText(chart.getName());
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:21,代码来源:WorkspaceTreeCellRenderer.java

示例2: getTreeCellRendererComponent

import javax.swing.tree.DefaultTreeCellRenderer; //导入方法依赖的package包/类
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
    DefaultTreeCellRenderer cellRenderer = (DefaultTreeCellRenderer) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
    tree.putClientProperty(TREE_TABLE_TREE_KEY, new JBTable());
    cellRenderer.setIcon(null);
    return cellRenderer;
}
 
开发者ID:JFrogDev,项目名称:jfrog-idea-plugin,代码行数:8,代码来源:LicensesTreeCellRenderer.java

示例3: getTreeCellRendererComponent

import javax.swing.tree.DefaultTreeCellRenderer; //导入方法依赖的package包/类
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
    DefaultTreeCellRenderer cellRenderer = (JBDefaultTreeCellRenderer) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
    tree.putClientProperty(TREE_TABLE_TREE_KEY, new JBTable()); // Avoid setting TreeUnfocusedSelectionBackground

    // Set icon
    Issue topIssue = ((ScanTreeNode) value).getTopIssue();
    cellRenderer.setIcon(IconUtils.load(StringUtils.lowerCase(topIssue.getSeverity().toString())));

    return cellRenderer;
}
 
开发者ID:JFrogDev,项目名称:jfrog-idea-plugin,代码行数:12,代码来源:IssuesTreeCellRenderer.java

示例4: getTreeCellRendererComponent

import javax.swing.tree.DefaultTreeCellRenderer; //导入方法依赖的package包/类
@Override
@Nonnull
public Component getTreeCellRendererComponent(@Nonnull final JTree tree, @Nonnull final Object value, final boolean sel, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) {
  final DefaultTreeCellRenderer result = (DefaultTreeCellRenderer) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
  if (value instanceof Topic) {
    result.setIcon(getIconForTopic((Topic) value));
    result.setText(extractTextFromTopic((Topic) value));
  }
  return result;
}
 
开发者ID:raydac,项目名称:netbeans-mmd-plugin,代码行数:11,代码来源:MindMapTreeCellRenderer.java

示例5: getTreeCellRendererComponent

import javax.swing.tree.DefaultTreeCellRenderer; //导入方法依赖的package包/类
@Override
public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) {
  final DefaultTreeCellRenderer result = (DefaultTreeCellRenderer) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
  if (value instanceof Topic) {
    result.setIcon(getIconForTopic((Topic) value));
    result.setText(extractTextFromTopic((Topic) value));
  }
  return result;
}
 
开发者ID:raydac,项目名称:netbeans-mmd-plugin,代码行数:10,代码来源:MindMapTreeCellRenderer.java


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