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