javax.swing.JComboBox.getRenderer()方法的使用及代码示例

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

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

JComboBox.getRenderer介绍

暂无

代码示例

代码示例来源:origin: kiegroup/optaplanner

public static void applyToComboBox(JComboBox comboBox) {
  comboBox.setRenderer(new LabeledComboBoxRenderer(comboBox.getRenderer()));
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

ColorComboBoxRendererWrapper (JComboBox comboBox) {
  this.renderer = comboBox.getRenderer();
  if( renderer instanceof ColorComboBoxRendererWrapper ) {
    throw new IllegalStateException("Custom renderer is already initialized."); //NOI18N
  }
  comboBox.setRenderer( this );
}

代码示例来源:origin: pentaho/mondrian

new EmptyBorder(
    0, 0, 0, 0)); //super.noFocusBorder);
listRenderer.setRenderer(new ListRenderer(listRenderer.getRenderer()));

代码示例来源:origin: freeplane/freeplane

@Override
public ListCellRenderer getRenderer() {
  if(rendererWithBorder == null)
    return super.getRenderer();
  else
    return rendererWithBorder;
}

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

@Override
  public void propertyChange(PropertyChangeEvent evt) {
    delegateRenderer = new JComboBox<ViewItem>().getRenderer();
  }
});

代码示例来源:origin: openpnp/openpnp

public SeparatorRenderer() {
  renderer = new JComboBox().getRenderer();
}

代码示例来源:origin: stackoverflow.com

// Create your combo box as normal, passing in the array of values.
final JComboBox combo = new JComboBox(values);
final ToString toString = new ToString() {
  public String toString(final Object object) {
    final YourValue value = (YourValue) object;
    // Of course you'd make your own label text below.
    return "custom label text " + value.toString();
  }
};
combo.setRenderer(new ToStringListCellRenderer(
    combo.getRenderer(), toString)));

代码示例来源:origin: com.anrisoftware.prefdialog/prefdialog-corefields

/**
 * Returns the renderer of the combo box field.
 * 
 * @return the {@link ListCellRenderer}.
 */
public ListCellRenderer<?> getRenderer() {
  return getComponent().getRenderer();
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

@Override public ListCellRenderer getRenderer() {
  ListCellRenderer editor = super.getRenderer();
  if (editor instanceof ObjectComboPrettyRender)
    return editor;
  ListCellRenderer cbo = new ObjectComboPrettyRender();
  return cbo;
}

代码示例来源:origin: stackoverflow.com

comboBox.addActionListener(new ActionListener() {
   @Override
   public void actionPerformed(ActionEvent e) {
     JComboBox combo = (JComboBox) e.getSource();
     int y = MouseInfo.getPointerInfo().getLocation().y - combo.getLocationOnScreen().y;
     int item =  y / combo.getHeight();
     ((CheckBoxRenderer) combo.getRenderer()).selected[item] = !((CheckBoxRenderer) combo.getRenderer()).selected[item];
   }
 });

代码示例来源:origin: org.optaplanner/optaplanner-examples

public static void applyToComboBox(JComboBox comboBox) {
  comboBox.setRenderer(new LabeledComboBoxRenderer(comboBox.getRenderer()));
}

代码示例来源:origin: protegeproject/protege

private void updateList() {
  ontologiesList.setSelectedItem(getOWLModelManager().getActiveOntology());
  ontologiesList.setRenderer(ontologiesList.getRenderer());
}

代码示例来源:origin: edu.stanford.protege/protege-editor-owl

private void updateList() {
  ontologiesList.setSelectedItem(getOWLModelManager().getActiveOntology());
  ontologiesList.setRenderer(ontologiesList.getRenderer());
}

代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl

private void updateList() {
  ontologiesList.setSelectedItem(getOWLModelManager().getActiveOntology());
  ontologiesList.setRenderer(ontologiesList.getRenderer());
}

代码示例来源:origin: joel-costigliola/assertj-swing

@RunsInCurrentThread
 @Nullable private Component cellRendererComponent(@Nonnull JComboBox comboBox, int index) {
  Object item = comboBox.getItemAt(index);
  ListCellRenderer renderer = comboBox.getRenderer();
  return renderer.getListCellRendererComponent(REFERENCE_JLIST, item, index, true, true);
 }
}

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

public CustomDelegateListCellRenderer(JComboBox<ViewItem> aComboBox, String label) {
  this.delegateRenderer = aComboBox.getRenderer();
  this.comboBox = aComboBox;
  this.label = label;
  
  this.viewItem = new ViewItem("", "", -1);
  
  this.comboBox.addPropertyChangeListener("UI", new PropertyChangeListener() {
    
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      delegateRenderer = new JComboBox<ViewItem>().getRenderer();
    }
  });
}

代码示例来源:origin: abbot/abbot

/** If the value looks meaningful, return it, otherwise return null. */
public String getValueAsString(JComboBox combo, JComponent popupComponent, Object item, int index) {
  Component c = combo.getRenderer().getListCellRendererComponent((JList)popupComponent, item, index, true, true);
  return convertRendererToString(c);
}

代码示例来源:origin: UISpec4J/UISpec4J

private String getRenderedValue(Object value, int index) {
  Component component =
   jComboBox.getRenderer().getListCellRendererComponent(REFERENCE_JLIST,
                              value, index, false, false);
  Object modelObject = (index == -1) ? null : jComboBox.getModel().getElementAt(index);
  return cellValueConverter.getValue(index, component, modelObject);
 }
}

代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-extra

public static void setAutoCompleted(JComboBox comboBox) {
  AutoCompletionManager autoCompletionManager = new AutoCompletionManager(
      comboBox);
  AutoCompletionModelListener autoCompletionModelListener = new AutoCompletionModelListener(
      autoCompletionManager);
  AutoCompletionCellRenderer autoCompletionCellRenderer = new AutoCompletionCellRenderer(
      autoCompletionManager, comboBox.getRenderer());
  comboBox.setKeySelectionManager(autoCompletionManager);
  comboBox.getModel().addListDataListener(autoCompletionModelListener);
  comboBox.setRenderer(autoCompletionCellRenderer);
}

代码示例来源:origin: org.nuiton/nuiton-widgets

public static void setAutoCompleted(JComboBox comboBox) {
  AutoCompletionManager autoCompletionManager = new AutoCompletionManager(
      comboBox);
  AutoCompletionModelListener autoCompletionModelListener = new AutoCompletionModelListener(
      autoCompletionManager);
  AutoCompletionCellRenderer autoCompletionCellRenderer = new AutoCompletionCellRenderer(
      autoCompletionManager, comboBox.getRenderer());
  comboBox.setKeySelectionManager(autoCompletionManager);
  comboBox.getModel().addListDataListener(autoCompletionModelListener);
  comboBox.setRenderer(autoCompletionCellRenderer);
}

相关文章

JComboBox类方法