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


Java BasicComboBoxRenderer.UIResource方法代码示例

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


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

示例1: createRenderer

import javax.swing.plaf.basic.BasicComboBoxRenderer; //导入方法依赖的package包/类
@Override
protected ListCellRenderer createRenderer() {
  return new BasicComboBoxRenderer.UIResource() {
    @Override
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
      final Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
      if (c instanceof JComponent) {
        final JComponent jc = (JComponent)c;
        if (index == -1) {
          jc.setOpaque(false);
          jc.setForeground(list.getForeground());
        } else {
          jc.setOpaque(true);
        }
      }
      return c;
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:DarculaComboBoxUI.java

示例2: createRenderer

import javax.swing.plaf.basic.BasicComboBoxRenderer; //导入方法依赖的package包/类
@Override
protected ListCellRenderer createRenderer() {
  return new BasicComboBoxRenderer.UIResource() {
    @Override
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
      final Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
      if (c instanceof JComponent) {
        final JComponent jc = (JComponent)c;
        if (index == -1) {
          jc.setOpaque(false);
          jc.setForeground(list.getForeground());
        }
        else {
          jc.setOpaque(true);
        }
      }
      return c;
    }
  };
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:ModernComboBoxUI.java

示例3: createRenderer

import javax.swing.plaf.basic.BasicComboBoxRenderer; //导入方法依赖的package包/类
protected ListCellRenderer createRenderer()
/* 105:    */   {
/* 106:186 */     if (this.tableCellEditor) {
/* 107:187 */       return super.createRenderer();
/* 108:    */     }
/* 109:189 */     BasicComboBoxRenderer renderer = new BasicComboBoxRenderer.UIResource();
/* 110:190 */     renderer.setBorder(UIManager.getBorder("ComboBox.rendererBorder"));
/* 111:191 */     return renderer;
/* 112:    */   }
 
开发者ID:xiwc,项目名称:confluence.keygen,代码行数:10,代码来源:PlasticComboBoxUI.java

示例4: createRenderer

import javax.swing.plaf.basic.BasicComboBoxRenderer; //导入方法依赖的package包/类
/**
 * Creates the default renderer that will be used in a non-editiable combo
 * box. A default renderer will used only if a renderer has not been
 * explicitly set with {@code setRenderer}.<p>
 *
 * This method differs from the superclass implementation
 * in that it uses an empty border with wider left and right margins
 * of 2 pixels instead of 1.
 *
 * @return a {@code ListCellRender} used for the combo box
 * @see javax.swing.JComboBox#setRenderer
 */
@Override
protected ListCellRenderer createRenderer() {
    if (tableCellEditor) {
        return super.createRenderer();
    }
    BasicComboBoxRenderer renderer = new BasicComboBoxRenderer.UIResource();
    renderer.setBorder(UIManager.getBorder("ComboBox.rendererBorder"));
    return renderer;
}
 
开发者ID:javachen,项目名称:IBMDataMovementTool,代码行数:22,代码来源:PlasticComboBoxUI.java

示例5: createRenderer

import javax.swing.plaf.basic.BasicComboBoxRenderer; //导入方法依赖的package包/类
/**
 * Creates the default renderer that will be used in a non-editiable combo
 * box. A default renderer will used only if a renderer has not been
 * explicitly set with {@code setRenderer}.<p>
 *
 * This method differs from the superclass implementation in that
 * it uses an empty border with the default left and right text insets,
 * the same as used by a combo box editor.
 *
 * @return a {@code ListCellRender} used for the combo box
 * @see javax.swing.JComboBox#setRenderer
 */
@Override
protected ListCellRenderer createRenderer() {
    if (tableCellEditor) {
        return super.createRenderer();
    }
    BasicComboBoxRenderer renderer = new BasicComboBoxRenderer.UIResource();
    renderer.setBorder(UIManager.getBorder("ComboBox.rendererBorder"));
    return renderer;
}
 
开发者ID:javachen,项目名称:IBMDataMovementTool,代码行数:22,代码来源:WindowsComboBoxUI.java

示例6: isRendererBorderRemovable

import javax.swing.plaf.basic.BasicComboBoxRenderer; //导入方法依赖的package包/类
/**
 * Checks and answer whether the border of the given renderer component
 * can be removed temporarily, so the combo's selection background will
 * be consistent with the default renderer and native appearance.
 * This test is invoked from {@code #paintCurrentValue}.<p>
 *
 * It is safe to remove an EmptyBorder if the component doesn't override
 * {@code #update}, {@code #paint} and {@code #paintBorder}.
 * Since we know the default renderer, we can remove its border.<p>
 *
 * Custom renderers may set a hint to make their border removable.
 * To do so, set the client property "isBorderRemovable"
 * to {@code Boolean.TRUE}. If this client property is set,
 * its value will be returned. If it is not set, {@code true} is returned
 * if and only if the component's border is an EmptyBorder.
 *
 * @param rendererComponent  the renderer component to check
 * @return true if the component's border can be removed, false if not
 * @see #paintCurrentValue(Graphics, Rectangle, boolean)
 */
protected boolean isRendererBorderRemovable(JComponent rendererComponent) {
    if (rendererComponent instanceof BasicComboBoxRenderer.UIResource) {
        return true;
    }
    Object hint = rendererComponent.getClientProperty(Options.COMBO_RENDERER_IS_BORDER_REMOVABLE);
    if (hint != null) {
        return Boolean.TRUE.equals(hint);
    }
    Border border = rendererComponent.getBorder();
    return border instanceof EmptyBorder;
}
 
开发者ID:javachen,项目名称:IBMDataMovementTool,代码行数:32,代码来源:WindowsComboBoxUI.java


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