本文整理了Java中javax.swing.JComboBox.setRenderer()
方法的一些代码示例,展示了JComboBox.setRenderer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComboBox.setRenderer()
方法的具体详情如下:
包路径:javax.swing.JComboBox
类名称:JComboBox
方法名:setRenderer
暂无
代码示例来源:origin: runelite/runelite
JComboBox box = new JComboBox(type.getEnumConstants());
box.setPreferredSize(new Dimension(box.getPreferredSize().width, 25));
box.setRenderer(new ComboBoxListRenderer());
box.setForeground(Color.WHITE);
box.setFocusable(false);
代码示例来源:origin: stackoverflow.com
getLocalGraphicsEnvironment();
String[] fonts = ge.getAvailableFontFamilyNames();
JComboBox fontChooser = new JComboBox(fonts);
fontChooser.setRenderer(new FontCellRenderer());
JOptionPane.showMessageDialog(null, fontChooser);
代码示例来源:origin: nodebox/nodebox
public MenuControl(String nodePath, Port port) {
super(nodePath, port);
setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));
menuBox = new JComboBox<>();
menuModel = new MenuDataModel(port);
MenuItemRenderer menuItemRenderer = new MenuItemRenderer();
menuBox.setModel(menuModel);
menuBox.setRenderer(menuItemRenderer);
menuBox.putClientProperty("JComponent.sizeVariant", "small");
menuBox.putClientProperty("JComboBox.isPopDown", Boolean.TRUE);
menuBox.setFont(Theme.SMALL_BOLD_FONT);
menuBox.addActionListener(this);
add(menuBox);
setValueForControl(port.getValue());
}
代码示例来源:origin: nodebox/nodebox
public FontControl(String nodePath, Port port) {
super(nodePath, port);
setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));
fontChooser = new JComboBox<>();
fontModel = new FontDataModel();
FontCellRenderer fontCellRenderer = new FontCellRenderer();
fontChooser.setModel(fontModel);
fontChooser.setRenderer(fontCellRenderer);
fontChooser.putClientProperty("JComponent.sizeVariant", "small");
fontChooser.setPreferredSize(new Dimension(150, 22));
fontChooser.putClientProperty("JComboBox.isPopDown", Boolean.TRUE);
fontChooser.addActionListener(this);
fontChooser.setFont(Theme.SMALL_BOLD_FONT);
add(fontChooser);
setValueForControl(port.getValue());
}
代码示例来源:origin: jbox2d/jbox2d
top.setBorder(BorderFactory.createCompoundBorder(new EtchedBorder(EtchedBorder.LOWERED),
BorderFactory.createEmptyBorder(10, 10, 10, 10)));
tests = new JComboBox(model.getComboModel());
tests.setMaximumRowCount(30);
tests.setMaximumSize(new Dimension(250, 20));
tests.addActionListener(this);
tests.setRenderer(new ListCellRenderer() {
JLabel categoryLabel = null;
JLabel testLabel = null;
代码示例来源:origin: stackoverflow.com
comboBox = new JComboBox( model );
comboBox.addActionListener( this );
comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
comboBox = new JComboBox( model );
comboBox.setRenderer( new ItemRenderer() );
comboBox.addActionListener( this );
getContentPane().add(comboBox, BorderLayout.SOUTH );
代码示例来源:origin: pentaho/mondrian
listRenderer = new JComboBox(MondrianGuiDef.Measure._aggregator_values);
listRenderer.setMaximumSize(stringRenderer.getMaximumSize());
listRenderer.setFont(Font.decode("Dialog"));
new EmptyBorder(
0, 0, 0, 0)); //super.noFocusBorder);
listRenderer.setRenderer(new ListRenderer(listRenderer.getRenderer()));
relationList = new JComboBox(
new String[]{
workbench.getResourceConverter().getString(
代码示例来源:origin: stackoverflow.com
JComboBox cmb = new JComboBox(strings);
ComboBoxRenderer renderer = new ComboBoxRenderer(cmb);
renderer.setStrings(strings);
cmb.setRenderer(renderer);
代码示例来源:origin: stackoverflow.com
JComboBox cb = new JComboBox();
cb.setRenderer(new ImageCellRenderer());
代码示例来源:origin: org.apache.cayenne/cayenne-nodeps
public ComboBoxEditor createComboBoxEditor(
ComboBoxModel model, ListCellRenderer renderer) {
JComboBox comboBox = new JComboBox(model);
if (renderer != null)
comboBox.setRenderer(renderer);
return new ComboBoxEditor(comboBox);
}
代码示例来源:origin: com.googlecode.blaisemath/blaise-graphics
/** Initialize the editor. */
public MarkerEditor() {
combo = new JComboBox();
combo.setModel(new DefaultComboBoxModel(MARKER_OPTIONS));
combo.setRenderer(new MarkerCellRenderer());
}
代码示例来源:origin: com.cedarsoft.commons.swing/common
@Nullable
public static <T> T showComboBoxDialog(@Nullable Component parentComponent, @Nonnull String message, @Nullable String title, @Nonnull MessageType messageType, @Nonnull ComboBoxModel<T> model, @Nullable Integer preselectedIndex, @Nullable ListCellRenderer<? super T> renderer) {
JComboBox<T> comboBox = new JComboBox<>(model);
if (preselectedIndex != null) {
comboBox.setSelectedIndex(preselectedIndex);
}
if (renderer != null) {
comboBox.setRenderer(renderer);
}
return showComboBoxDialog(parentComponent, message, title, messageType, comboBox);
}
代码示例来源:origin: org.gdl-lang.gdl-tools/cds-gui-swing
private JComboBox getDomainSelector() {
if (domainComboBox == null) {
domainComboBox = new JComboBox<>();
domainComboBox.addItem(ANY_DOMAIN);
domainComboBox.addItem(Domains.EHR_ID);
domainComboBox.addItem(Domains.CDS_ID);
domainComboBox.setRenderer(new DomainComboBoxRenderer<>());
domainComboBox.setSelectedItem(Domains.EHR_ID);
}
return domainComboBox;
}
代码示例来源:origin: org.objectstyle.cayenne/cayenne
public ComboBoxEditor createComboBoxEditor(
ComboBoxModel model, ListCellRenderer renderer) {
JComboBox comboBox = new JComboBox(model);
if (renderer != null)
comboBox.setRenderer(renderer);
return new ComboBoxEditor(comboBox);
}
代码示例来源:origin: stackoverflow.com
JComboBox box = new JComboBox();
box.addItem(new MyObject(..., ...));
//...
box.setRenderer(new MyObjectListCellRenderer());
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javafx2-project
private static TableCellEditor createEditor() {
final JComboBox combo = new JComboBox(new Object[] {Boolean.TRUE, Boolean.FALSE});
combo.setRenderer(new DefaultListCellRenderer(){
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
return super.getListCellRendererComponent(
list,
NbBundle.getMessage(JFXDownloadModePanel.class, value == Boolean.TRUE ? "TXT_LAZY":"TXT_EAGER"), //NOI18N
index,
isSelected,
cellHasFocus);
}
});
return new DefaultCellEditor(combo);
}
代码示例来源:origin: Killerardvark/CryodexSource
private JComboBox<String> getGame2ResultCombo() {
if (game2ResultsCombo == null) {
game2ResultsCombo = new JComboBox<String>(getComboValues());
game2ResultsCombo.setRenderer(new DefaultListCellRenderer() {
private static final long serialVersionUID = 1L;
@Override
public void paint(Graphics g) {
setForeground(Color.BLACK);
super.paint(g);
}
});
game2ResultsCombo.addActionListener(this);
}
return game2ResultsCombo;
}
代码示例来源:origin: Killerardvark/CryodexSource
private JComboBox<String> getResultCombo() {
if (resultsCombo == null) {
resultsCombo = new JComboBox<String>(getComboValues());
resultsCombo.setRenderer(new DefaultListCellRenderer() {
private static final long serialVersionUID = 1L;
@Override
public void paint(Graphics g) {
setForeground(Color.BLACK);
super.paint(g);
}
});
resultsCombo.addActionListener(GamePanel.this);
}
return resultsCombo;
}
代码示例来源:origin: org.zaproxy/zap
/**
* This method initializes the combobox for HandleParameters option.
*
* @return the combo handle parameters
*/
@SuppressWarnings("unchecked")
private JComboBox<HandleParametersOption> getComboHandleParameters() {
if (handleParameters == null) {
handleParameters = new JComboBox<>(new HandleParametersOption[] {
HandleParametersOption.USE_ALL, HandleParametersOption.IGNORE_VALUE,
HandleParametersOption.IGNORE_COMPLETELY });
handleParameters.setRenderer(new HandleParametersOptionRenderer());
}
return handleParameters;
}
代码示例来源:origin: Killerardvark/CryodexSource
private JComboBox<String> getResultCombo() {
if (resultsCombo == null) {
resultsCombo = new JComboBox<String>(getComboValues());
resultsCombo.setRenderer(new DefaultListCellRenderer() {
private static final long serialVersionUID = 1L;
@Override
public void paint(Graphics g) {
setForeground(Color.BLACK);
super.paint(g);
}
});
resultsCombo.addActionListener(GamePanel.this);
}
return resultsCombo;
}
内容来源于网络,如有侵权,请联系作者删除!