/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public void setSelectedItem(Object anItem) { E input = null; if (enumClass.isInstance(anItem)) { input = (E) anItem; } else { input = valueMap.get(anItem); } if (input != null || anItem == null) { selected = input; } this.fireContentsChanged(this, 0, getSize()); }
public EnumParam(String name, Class<E> enumClass) { super(name, RandomizePolicy.ALLOW_RANDOMIZE); this.enumConstants = enumClass.getEnumConstants(); defaultValue = enumConstants[0]; delegateModel = new EnumComboBoxModel<>(enumClass); }
@Override public void addListDataListener(ListDataListener l) { delegateModel.addListDataListener(l); }
@Override public int getSize() { return delegateModel.getSize(); }
public TwoPointPaintType getSelectedFillPaint() { return fillPaintModel.getSelectedItem(); }
public void addCopyBrushTypeSelector(CopyBrushType defaultSelection, CopyBrushTypeChangedListener listener) { EnumComboBoxModel<CopyBrushType> typeModel = new EnumComboBoxModel<>(CopyBrushType.class); typeModel.setSelectedItem(defaultSelection); JComboBox<CopyBrushType> typeCB = new JComboBox<>(typeModel); addWithLabel("Brush:", typeCB, "typeCB"); typeCB.addActionListener(e -> { CopyBrushType brushType = (CopyBrushType) typeCB.getSelectedItem(); listener.copyBrushTypeChanged(brushType); }); }
@Override public E getElementAt(int index) { return delegateModel.getElementAt(index); }
public JComboBox<TwoPointPaintType> createStrokePaintCombo() { JComboBox cb = new JComboBox<>(strokePaintModel); cb.setMaximumRowCount(strokePaintModel.getSize()); cb.addActionListener(e -> guiChanged()); return cb; }
@Override public Object getSelectedItem() { return delegateModel.getSelectedItem(); }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public void setSelectedItem(Object anItem) { E input = null; if (enumClass.isInstance(anItem)) { input = (E) anItem; } else { input = valueMap.get(anItem); } if (input != null || anItem == null) { selected = input; } this.fireContentsChanged(this, 0, getSize()); }
public JComboBox<TwoPointPaintType> createFillPaintCombo() { JComboBox cb = new JComboBox<>(fillPaintModel); cb.setMaximumRowCount(fillPaintModel.getSize()); cb.addActionListener(e -> guiChanged()); return cb; }
public E getSelected() { return delegateModel.getSelectedItem(); }
private void addInterpolationSelector(GridBagHelper gbh) { EnumComboBoxModel<Interpolation> ipCBM = new EnumComboBoxModel<>(Interpolation.class); ipCB = new JComboBox<>(ipCBM); gbh.addLabelWithControl("Interpolation:", ipCB); }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public void setSelectedItem(Object anItem) { E input = null; if (enumClass.isInstance(anItem)) { input = (E) anItem; } else { input = valueMap.get(anItem); } if (input != null || anItem == null) { selected = input; } this.fireContentsChanged(this, 0, getSize()); }
public JComboBox<ShapeType> createShapeTypeCombo() { JComboBox<ShapeType> shapeTypeCB = new JComboBox<>(typeModel); // make sure all values are visible without a scrollbar shapeTypeCB.setMaximumRowCount(typeModel.getSize()); shapeTypeCB.addActionListener(e -> guiChanged()); return shapeTypeCB; }
protected Symmetry getSymmetry() { return symmetryModel.getSelectedItem(); }
private void addOutputTypeSelector(GridBagHelper gbh) { //noinspection unchecked EnumComboBoxModel<TweenOutputType> model = new EnumComboBoxModel(TweenOutputType.class); outputTypeCB = new JComboBox<>(model); outputTypeCB.addActionListener(e -> outputTypeChanged()); outputTypeChanged(); // initial setup gbh.addLabelWithControl("Output Type:", outputTypeCB); }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public void setSelectedItem(Object anItem) { E input = null; if (enumClass.isInstance(anItem)) { input = (E) anItem; } else { input = valueMap.get(anItem); } if (input != null || anItem == null) { selected = input; } this.fireContentsChanged(this, 0, getSize()); }
public ShapeType getSelectedType() { return typeModel.getSelectedItem(); }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public void setSelectedItem(Object anItem) { E input = null; if (enumClass.isInstance(anItem)) { input = (E) anItem; } else { input = valueMap.get(anItem); } if (input != null || anItem == null) { selected = input; } this.fireContentsChanged(this, 0, getSize()); }