Java 类javax.swing.SpinnerListModel 实例源码

项目:alevin-svn2    文件:SatelliteMultiViewerCorner.java   
public SatelliteMultiViewerCorner() {
    layer = new SpinnerListModel();
    layer.addChangeListener(new ChangeListener() {
        @SuppressWarnings("rawtypes")
        @Override
        public void stateChanged(ChangeEvent e) {
            // find viewer for satellite
            if (layer.getValue() instanceof LayerViewer)
                setViewer((LayerViewer) layer.getValue());
            else
                setViewer(null);
        }
    });
    spinner = new JSpinner(layer);
    // Workaround to fix the satellite jumping issue
    // caused by changeevent-setviewer-dolayout-setvalue-(layoutinvalid)
    spinner.setPreferredSize(new Dimension(105, 22));
    getSatellite().getContentPane().add(spinner, BorderLayout.NORTH);
    // by default disabled
    setEnabled(false);
}
项目:QN-ACTR-Release    文件:GraphArrivalPanel.java   
/**
 * Used when a spinne value is updated
 */
private void setBounds() {
    double xmin, xmax, ymin, ymax;
    Object val;
    String val1 = (String) Xmin.getValue();
    Vector v = (Vector) ((SpinnerListModel) Xmin.getModel()).getList();
    xmin = v.indexOf(val1) + 1;
    String val2 = (String) Xmax.getValue();
    Vector v2 = (Vector) ((SpinnerListModel) Xmax.getModel()).getList();
    xmax = v2.indexOf(val2) + 1;
    val = Ymin.getValue();
    if (val instanceof Number) {
        ymin = ((Number) val).doubleValue();
    } else {
        ymin = graph.getYRange()[0];
    }
    val = Ymax.getValue();
    if (val instanceof Number) {
        ymax = ((Number) val).doubleValue();
    } else {
        ymax = graph.getYRange()[1];
    }

    // Sets bounds
    graph.setXRange(xmin, xmax);
    graph.setYRange(ymin, ymax);
    graph.repaint();
}
项目:javify    文件:SpinnerDemo.java   
private JPanel createPanel3()
{
  JPanel panel = new JPanel(new BorderLayout());
  this.spinnerState3 = new JCheckBox("Enabled", true);
  this.spinnerState3.setActionCommand("COMBO_STATE3");
  this.spinnerState3.addActionListener(this);
  panel.add(this.spinnerState3, BorderLayout.EAST);

  JPanel controlPanel = new JPanel();
  controlPanel.setBorder(BorderFactory.createTitledBorder("List Spinner: "));
  this.spinner5 = new JSpinner(new SpinnerListModel(new Object[] {"Red",
      "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}));

  this.spinner6 = new JSpinner(new SpinnerListModel(new Object[] {"Red",
      "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}));
  this.spinner6.setValue("Yellow");
  this.spinner6.setFont(new Font("Dialog", Font.PLAIN, 20));

  controlPanel.add(this.spinner5);
  controlPanel.add(this.spinner6);

  panel.add(controlPanel);

  return panel;
}
项目:code-similarity    文件:SpinnerDemo.java   
public static void main(String[] args) {
    JFrame jf = new JFrame("It Spins");
    Container cp = jf.getContentPane();
    cp.setLayout(new GridLayout(0,1));

    // Create a JSpinner using one of the pre-defined SpinnerModels
    JSpinner dates = new JSpinner(new SpinnerDateModel());
    cp.add(dates);

    // Create a JSPinner using a SpinnerListModel. 
    String[] data = { "One", "Two", "Three" };
    JSpinner js = new JSpinner(new SpinnerListModel(data));
    cp.add(js);

    jf.setSize(100, 80);
    jf.setVisible(true);
}
项目:jvm-stm    文件:SpinnerDemo.java   
private JPanel createPanel3() 
{
  JPanel panel = new JPanel(new BorderLayout());
  this.spinnerState3 = new JCheckBox("Enabled", true);
  this.spinnerState3.setActionCommand("COMBO_STATE3");
  this.spinnerState3.addActionListener(this);
  panel.add(this.spinnerState3, BorderLayout.EAST);

  JPanel controlPanel = new JPanel();
  controlPanel.setBorder(BorderFactory.createTitledBorder("List Spinner: "));
  this.spinner5 = new JSpinner(new SpinnerListModel(new Object[] {"Red", 
      "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}));

  this.spinner6 = new JSpinner(new SpinnerListModel(new Object[] {"Red", 
      "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}));
  this.spinner6.setValue("Yellow");
  this.spinner6.setFont(new Font("Dialog", Font.PLAIN, 20));

  controlPanel.add(this.spinner5);
  controlPanel.add(this.spinner6);

  panel.add(controlPanel);

  return panel;
}
项目:mgoban    文件:BoardSettingPanel.java   
public BoardSettingPanel() {
    int[] boardSizeArray = {9, 13, 19};
    ArrayList<Integer> boardSizeList = arrayToList(boardSizeArray);

    int[] handicapArray = {0, 2, 3, 4, 5, 6, 7, 8, 9};
    ArrayList<Integer> handicapList = arrayToList(handicapArray);

    boardSizeModel = new SpinnerListModel(boardSizeList);
    handicapModel = new SpinnerListModel(handicapList);
    komiModel = new SpinnerNumberModel(6.5, -100.0, 100.0, 0.5);

    initComponents();

    boardSizeLabel.setText(BOARDSIZE);
    handicapLabel.setText(HANDICAP);
    komiLabel.setText(KOMI);

    boardSizeSpinner.setModel(boardSizeModel);
    handicapSpinner.setModel(handicapModel);
    komiSpinner.setModel(komiModel);

    boardSizeSpinner.setValue(new Integer(19));
}
项目:mgoban    文件:NewGameTreePanel.java   
public NewGameTreePanel() {
    int[] boardSizeArray = {9, 13, 19};
    ArrayList<Integer> boardSizeList = arrayToList(boardSizeArray);

    int[] handicapArray = {0, 2, 3, 4, 5, 6, 7, 8, 9};
    ArrayList<Integer> handicapList = arrayToList(handicapArray);

    boardSizeModel = new SpinnerListModel(boardSizeList);
    handicapModel = new SpinnerListModel(handicapList);
    komiModel = new SpinnerNumberModel(6.5, -100.0, 100.0, 0.5);

    initComponents();

    boardSizeSpinner.setModel(boardSizeModel);
    handicapSpinner.setModel(handicapModel);
    komiSpinner.setModel(komiModel);

    boardSizeSpinner.setValue(new Integer(19));

    handicapCheckBox.setSelected(true);
    komiCheckBox.setSelected(true);
}
项目:Alevin    文件:SatelliteMultiViewerCorner.java   
public SatelliteMultiViewerCorner() {
    layer = new SpinnerListModel();
    layer.addChangeListener(new ChangeListener() {
        @SuppressWarnings("rawtypes")
        @Override
        public void stateChanged(ChangeEvent e) {
            // find viewer for satellite
            if (layer.getValue() instanceof LayerViewer)
                setViewer((LayerViewer) layer.getValue());
            else
                setViewer(null);
        }
    });
    spinner = new JSpinner(layer);
    // Workaround to fix the satellite jumping issue
    // caused by changeevent-setviewer-dolayout-setvalue-(layoutinvalid)
    spinner.setPreferredSize(new Dimension(105, 22));
    getSatellite().getContentPane().add(spinner, BorderLayout.NORTH);
    // by default disabled
    setEnabled(false);
}
项目:JamVM-PH    文件:SpinnerDemo.java   
private JPanel createPanel3() 
{
  JPanel panel = new JPanel(new BorderLayout());
  this.spinnerState3 = new JCheckBox("Enabled", true);
  this.spinnerState3.setActionCommand("COMBO_STATE3");
  this.spinnerState3.addActionListener(this);
  panel.add(this.spinnerState3, BorderLayout.EAST);

  JPanel controlPanel = new JPanel();
  controlPanel.setBorder(BorderFactory.createTitledBorder("List Spinner: "));
  this.spinner5 = new JSpinner(new SpinnerListModel(new Object[] {"Red", 
      "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}));

  this.spinner6 = new JSpinner(new SpinnerListModel(new Object[] {"Red", 
      "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}));
  this.spinner6.setValue("Yellow");
  this.spinner6.setFont(new Font("Dialog", Font.PLAIN, 20));

  controlPanel.add(this.spinner5);
  controlPanel.add(this.spinner6);

  panel.add(controlPanel);

  return panel;
}
项目:classpath    文件:SpinnerDemo.java   
private JPanel createPanel3()
{
  JPanel panel = new JPanel(new BorderLayout());
  this.spinnerState3 = new JCheckBox("Enabled", true);
  this.spinnerState3.setActionCommand("COMBO_STATE3");
  this.spinnerState3.addActionListener(this);
  panel.add(this.spinnerState3, BorderLayout.EAST);

  JPanel controlPanel = new JPanel();
  controlPanel.setBorder(BorderFactory.createTitledBorder("List Spinner: "));
  this.spinner5 = new JSpinner(new SpinnerListModel(new Object[] {"Red",
      "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}));

  this.spinner6 = new JSpinner(new SpinnerListModel(new Object[] {"Red",
      "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}));
  this.spinner6.setValue("Yellow");
  this.spinner6.setFont(new Font("Dialog", Font.PLAIN, 20));

  controlPanel.add(this.spinner5);
  controlPanel.add(this.spinner6);

  panel.add(controlPanel);

  return panel;
}
项目:jmt    文件:GraphArrivalPanel.java   
/**
 * Used when a spinne value is updated
 */
private void setBounds() {
    double xmin, xmax, ymin, ymax;
    Object val;
    String val1 = (String) Xmin.getValue();
    Vector v = (Vector) ((SpinnerListModel) Xmin.getModel()).getList();
    xmin = v.indexOf(val1) + 1;
    String val2 = (String) Xmax.getValue();
    Vector v2 = (Vector) ((SpinnerListModel) Xmax.getModel()).getList();
    xmax = v2.indexOf(val2) + 1;
    val = Ymin.getValue();
    if (val instanceof Number) {
        ymin = ((Number) val).doubleValue();
    } else {
        ymin = graph.getYRange()[0];
    }
    val = Ymax.getValue();
    if (val instanceof Number) {
        ymax = ((Number) val).doubleValue();
    } else {
        ymax = graph.getYRange()[1];
    }

    // Sets bounds
    graph.setXRange(xmin, xmax);
    graph.setYRange(ymin, ymax);
    graph.repaint();
}
项目:marathonv5    文件:JSpinnerJavaElementTest.java   
private JSpinner createListSpinner() {
    String[] monthStrings = { "January", "February", "March", "April" };
    SpinnerListModel spinnerListModel = new SpinnerListModel(monthStrings);
    JSpinner listSpinner = new JSpinner(spinnerListModel);
    listSpinner.setName("list-spinner");
    return listSpinner;
}
项目:openjdk-jdk10    文件:JSpinnerOperator.java   
/**
 * Returns a minimal value. Returns null if model is not one of the
 * following: {@code javax.swing.SpinnerDateModel},
 * {@code javax.swing.SpinnerListModel},
 * {@code javax.swing.SpinnerNumberModel}. Also, returns null if the
 * model does not have a minimal value.
 *
 * @return a minimal value.
 */
public Object getMinimum() {
    SpinnerModel model = getModel();
    if (model instanceof SpinnerNumberModel) {
        return ((SpinnerNumberModel) model).getMinimum();
    } else if (model instanceof SpinnerDateModel) {
        return ((SpinnerDateModel) model).getEnd();
    } else if (model instanceof SpinnerListModel) {
        List<?> list = ((SpinnerListModel) model).getList();
        return list.get(list.size() - 1);
    } else {
        return null;
    }
}
项目:openjdk-jdk10    文件:JSpinnerOperator.java   
/**
 * Returns a maximal value. Returns null if model is not one of the
 * following: {@code javax.swing.SpinnerDateModel},
 * {@code javax.swing.SpinnerListModel},
 * {@code javax.swing.SpinnerNumberModel}. Also, returns null if the
 * model does not have a maximal value.
 *
 * @return a maximal value.
 */
public Object getMaximum() {
    SpinnerModel model = getModel();
    if (model instanceof SpinnerNumberModel) {
        return ((SpinnerNumberModel) model).getMaximum();
    } else if (model instanceof SpinnerDateModel) {
        return ((SpinnerDateModel) model).getEnd();
    } else if (model instanceof SpinnerListModel) {
        List<?> list = ((SpinnerListModel) model).getList();
        return list.get(list.size() - 1);
    } else {
        return null;
    }
}
项目:openjdk9    文件:JSpinnerOperator.java   
/**
 * Returns a minimal value. Returns null if model is not one of the
 * following: {@code javax.swing.SpinnerDateModel},
 * {@code javax.swing.SpinnerListModel},
 * {@code javax.swing.SpinnerNumberModel}. Also, returns null if the
 * model does not have a minimal value.
 *
 * @return a minimal value.
 */
public Object getMinimum() {
    SpinnerModel model = getModel();
    if (model instanceof SpinnerNumberModel) {
        return ((SpinnerNumberModel) model).getMinimum();
    } else if (model instanceof SpinnerDateModel) {
        return ((SpinnerDateModel) model).getEnd();
    } else if (model instanceof SpinnerListModel) {
        List<?> list = ((SpinnerListModel) model).getList();
        return list.get(list.size() - 1);
    } else {
        return null;
    }
}
项目:openjdk9    文件:JSpinnerOperator.java   
/**
 * Returns a maximal value. Returns null if model is not one of the
 * following: {@code javax.swing.SpinnerDateModel},
 * {@code javax.swing.SpinnerListModel},
 * {@code javax.swing.SpinnerNumberModel}. Also, returns null if the
 * model does not have a maximal value.
 *
 * @return a maximal value.
 */
public Object getMaximum() {
    SpinnerModel model = getModel();
    if (model instanceof SpinnerNumberModel) {
        return ((SpinnerNumberModel) model).getMaximum();
    } else if (model instanceof SpinnerDateModel) {
        return ((SpinnerDateModel) model).getEnd();
    } else if (model instanceof SpinnerListModel) {
        List<?> list = ((SpinnerListModel) model).getList();
        return list.get(list.size() - 1);
    } else {
        return null;
    }
}
项目:audiveris    文件:IntegerListSpinner.java   
/**
 * Creates a new IntegerListSpinner object.
 */
public IntegerListSpinner ()
{
    setModel(new SpinnerListModel());

    // Right alignment
    JSpinner.DefaultEditor editor;
    editor = (JSpinner.DefaultEditor) getEditor();
    editor.getTextField().setHorizontalAlignment(JTextField.RIGHT);
}
项目:audiveris    文件:SpinnerUtil.java   
/**
 * Assign the List model (for a list-based spinner)
 *
 * @param spinner the spinner to update
 * @param values  the model list values
 */
public static void setList (JSpinner spinner,
                            List<?> values)
{
    SpinnerModel model = spinner.getModel();

    if (model instanceof SpinnerListModel) {
        ((SpinnerListModel) model).setList(values);
    } else {
        throw new IllegalArgumentException("Spinner model is not a SpinnerListModel");
    }
}
项目:audiveris    文件:TemplateBoard.java   
/**
 * Creates a new {@code TemplateBoard} object.
 *
 * @param sheet           related sheet
 * @param table           the table of distances
 * @param templateService template bus
 */
public TemplateBoard (Sheet sheet,
                      DistanceTable table,
                      SelectionService templateService)
{
    super(Board.TEMPLATE, sheet.getLocationService(), eventsRead, true, false, false, false);
    this.sheet = sheet;
    this.table = table;
    this.templateService = templateService;

    // Shape spinner
    shapeSpinner = new JSpinner(
            new SpinnerListModel(new ArrayList<Shape>(ShapeSet.TemplateNotes)));
    shapeSpinner.addChangeListener(this);
    shapeSpinner.setName("shapeSpinner");
    shapeSpinner.setToolTipText("Selection of template shape");

    // Anchor spinner (with only relevant anchor values for templates)
    anchorSpinner = new JSpinner(
            new SpinnerListModel(
                    Arrays.asList(Anchor.LEFT_STEM, Anchor.RIGHT_STEM, Anchor.MIDDLE_LEFT)));
    anchorSpinner.addChangeListener(this);
    anchorSpinner.setName("anchorSpinner");
    anchorSpinner.setToolTipText("Selection of template anchor");

    // Eval field
    evalField.setEditable(false);
    evalField.setHorizontalAlignment(JTextField.CENTER);
    evalField.setToolTipText("Matching grade");

    defineLayout();
}
项目:DigitalMediaServer    文件:CustomJSpinner.java   
@Override
protected JComponent createEditor(SpinnerModel model) {
    if (model instanceof SpinnerDateModel) {
        return new DateEditor(this);
    } else if (model instanceof SpinnerNumberModel) {
        return new NumberEditor(this);
    } else if (model instanceof SpinnerListModel) {
        return new ListEditor(this);
    } else if (model instanceof SpinnerIntModel) {
        return new IntegerEditor(this);
    } else {
        return new DefaultEditor(this);
    }
}
项目:pumpernickel    文件:LargeNavigationPanelUI.java   
/** Create a minimal demo for the javadoc. */
public static JSpinner createDemo(boolean useNumbers) {
    JSpinner spinner;
    if(useNumbers) {
        spinner = new JSpinner(new SpinnerNumberModel(5,1,10,1));
    } else {
        spinner = new JSpinner(new SpinnerListModel(new Object[] {"Red", "Green", "Blue"}));
    }
    spinner.setUI(new LargeNavigationPanelUI());
    spinner.setBorder(new EmptyBorder(5,5,5,5));
    return spinner;
}
项目:openwonderland    文件:NamePropertiesPanel.java   
public NamePropertiesPanel() {
    initComponents();
    String[] spinnerValues = new String[]{
        SMALL_STRING, REGULAR_STRING, LARGE_STRING};
    myNameFontSizeSpinner.setModel(new SpinnerListModel(spinnerValues));
    myNameFontSizeSpinner.setValue(REGULAR_STRING);
    otherNamesFontSizeSpinner.setModel(new SpinnerListModel(spinnerValues));
    otherNamesFontSizeSpinner.setValue(REGULAR_STRING);
    ((DefaultEditor) myNameFontSizeSpinner.getEditor()).getTextField().
            setEditable(false);
    ((DefaultEditor) otherNamesFontSizeSpinner.getEditor()).getTextField().
            setEditable(false);
}
项目:libreveris    文件:IntegerListSpinner.java   
/**
 * Creates a new IntegerListSpinner object.
 */
public IntegerListSpinner ()
{
    setModel(new SpinnerListModel());

    // Right alignment
    JSpinner.DefaultEditor editor;
    editor = (JSpinner.DefaultEditor) getEditor();
    editor.getTextField()
            .setHorizontalAlignment(JTextField.RIGHT);
}
项目:libreveris    文件:SpinnerUtil.java   
/**
 * Assign the List model (for a list-based spinner)
 *
 * @param spinner the spinner to update
 * @param values  the model list values
 */
public static void setList (JSpinner spinner,
                            List<?> values)
{
    SpinnerModel model = spinner.getModel();

    if (model instanceof SpinnerListModel) {
        ((SpinnerListModel) model).setList(values);
    } else {
        throw new IllegalArgumentException(
                "Spinner model is not a SpinnerListModel");
    }
}
项目:socom    文件:ClientGuiFrame.java   
@SuppressWarnings("unchecked")
@Override
public void update(Observable arg0, Object arg1) {
    if (arg1 instanceof List) {
        List<String> lst = (List<String>) arg1;
        URLSpinner.setModel(new SpinnerListModel(lst));
        URLSpinner.setValue(lst.get(lst.size() - 1));
        URLSpinner.setFont(new Font("monospace", Font.PLAIN, 12));
        ((DefaultEditor) URLSpinner.getEditor()).getTextField().setEditable(false);
        URLSpinner.setVisible(false);
        URLSpinner.setVisible(true);
    }
}
项目:SFXR-Plus-Plus    文件:SFXRpp.java   
public void initWin() {
    getContentPane().setLayout(new MigLayout("center, fill"));
    initTopButtons();
    initLeftDock();

    getContentPane().add(new JLabel("Wave Form"), "center");

    waveForm = new JSpinner(new SpinnerListModel(WaveForm.values()));
    getContentPane().add(waveForm, "span, growx, wrap");

    volume = new JSlider(0, sliderPrecision);
    volume.addChangeListener(this);
    volumeVal = new JLabel();

    getContentPane().add(new JLabel("Master Volume"));
    getContentPane().add(volume, "growx");
    getContentPane().add(volumeVal, "wrap");

    slidersContainer = new JPanel(new MigLayout("center, fill"));

    initSliders();
    for (int i = 0; i < sliders.length; i++) {
        sliders[i].addChangeListener(this);
    }

    JScrollPane slidersC = new JScrollPane(slidersContainer,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    getContentPane().add(slidersC, "growx, span, wrap, center");

    soundVis = new SoundVisualizer();
    getContentPane().add(soundVis, "dock south, growx, span");

}
项目:schedule-editor    文件:AgencyAndIdSelector.java   
public AgencyAndIdSelector (DataManager dataManager) {
    super();

    this.dataManager = dataManager;

    // Agency selector
    updateAgencyList();
    SpinnerListModel slm = new SpinnerListModel(agencies);
    agencySelector = new JSpinner(slm);
    this.add(agencySelector);

    idEntry = new JTextField("", 15);
    this.add(idEntry);
}
项目:schedule-editor    文件:AgencyAndIdSelector.java   
/** Update the list of agencies for the spinner */
private void updateAgencyList () {
    agencies = new ArrayList<String>();
    for (Agency agency : dataManager.getDao().getAllAgencies()) {
        agencies.add(agency.getId());
    }

    try {
        ((SpinnerListModel) agencySelector.getModel()).setList(agencies);
    } catch (NullPointerException e) {
        // Spinner not initialized: do nothing
    }
}
项目:jmt    文件:BlockingRegionParameterPanel.java   
/**
 * This method will update data inside table and input components
 */
protected void updateData() {
    // Name of region and global number of customers
    name.setText(brd.getRegionName(key));
    Integer customer = brd.getRegionCustomerConstraint(key);
    if (customer.intValue() > 0) {
        number.setValue(customer);
        number.setEnabled(true);
        inf.setSelected(false);
    } else {
        number.setValue(Float.POSITIVE_INFINITY);
        number.setEnabled(false);
        inf.setSelected(true);
    }

    Integer MemorySize = brd.getRegionMemorySize(key);
    if (MemorySize.intValue() > 0) {
        memory.setValue(MemorySize);
        memory.setEnabled(true);
        mInf.setSelected(false);
    } else {
        memory.setValue(Float.POSITIVE_INFINITY);
        memory.setEnabled(false);
        mInf.setSelected(true);
    }

    Integer numOfGroup = brd.getRegionGroupList(key).size();
    if (numOfGroup.intValue() > 0) {
        gNumber.setModel(new SpinnerNumberModel());
        gNumber.setValue(numOfGroup);
        gNumber.setEnabled(true);
        gEnable.setSelected(true);
        mainPanel.setEnabledAt(1, true);
    } else {
        gNumber.setModel(new SpinnerListModel(new String[]{"--"}));
        ((DefaultEditor) gNumber.getEditor()).getTextField().setHorizontalAlignment(JTextField.RIGHT);
        gNumber.setValue("--");
        gNumber.setEnabled(false);
        gEnable.setSelected(false);
        mainPanel.setEnabledAt(1, false);
    }
}
项目:etomica    文件:ViewSpeciesSelection.java   
public SpinnerListModel getCountOfSpeciesSLM(int index) {
    return countOfSpeciesSLM[index];
}
项目:etomica    文件:ViewSpeciesSelection.java   
public void setCountOfSpeciesSLM(SpinnerListModel countOfSpecies1SLM,int index) {
    this.countOfSpeciesSLM[index] = countOfSpecies1SLM;
}
项目:openjdk-jdk10    文件:JSpinnerOperator.java   
private ListScrollAdjuster(JSpinnerOperator oper) {
    checkModel(oper, SpinnerListModel.class);
    model = (SpinnerListModel) oper.getModel();
    elements = model.getList();
}
项目:openjdk-jdk10    文件:JSpinnerOperator.java   
private ListSpinnerOperator(JSpinnerOperator spinner) {
    super((JSpinner) spinner.getSource());
    copyEnvironment(spinner);
    checkModel(this, SpinnerListModel.class);
}
项目:openjdk9    文件:JSpinnerOperator.java   
private ListScrollAdjuster(JSpinnerOperator oper) {
    checkModel(oper, SpinnerListModel.class);
    model = (SpinnerListModel) oper.getModel();
    elements = model.getList();
}
项目:openjdk9    文件:JSpinnerOperator.java   
private ListSpinnerOperator(JSpinnerOperator spinner) {
    super((JSpinner) spinner.getSource());
    copyEnvironment(spinner);
    checkModel(this, SpinnerListModel.class);
}
项目:audiveris    文件:SymbolRipper.java   
/**
 * Creates a new SymbolRipper object.
 */
public SymbolRipper ()
{
    // Related frame
    frame = new JFrame();
    frame.setTitle("Symbol Ripper");

    // Actors
    drawing = new Drawing();

    fontBase.setModel(new SpinnerListModel(new Integer[]{0, 0xf000, 0x1d100}));
    SpinnerUtil.setRightAlignment(fontBase);
    SpinnerUtil.fixIntegerList(fontBase);

    fontName.setModel(
            new SpinnerListModel(
                    GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()));

    // Initial values
    ///fontName.getSpinner().setValue("MusicalSymbols");
    fontName.getSpinner().setValue("Symbola");
    fontBase.setValue(0); //0);
    fontSize.setValue(200);
    pointCode.setModel(new SpinnerNumberModel(0x1d100, 0, 0x1d1ff, 1));
    width.setValue(400);
    height.setValue(500);
    xOffset.setValue(200);
    yOffset.setValue(300);
    changeCode();
    defineFont();

    // Listeners
    fontName.addChangeListener(paramListener);
    fontBase.addChangeListener(paramListener);
    fontSize.addChangeListener(paramListener);
    pointCode.addChangeListener(paramListener);
    hexaCode.addChangeListener(paramListener);
    xOffset.addChangeListener(paramListener);
    yOffset.addChangeListener(paramListener);
    width.addChangeListener(paramListener);
    height.addChangeListener(paramListener);

    // Global layout
    defineLayout();

    // Frame behavior
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    OMR.gui.getApplication().show(frame);

    // Actions
    image = buildImage();
    frame.repaint();
}
项目:ca-iris    文件:PollPeriodCellEditor.java   
/** Create a new poll period cell editor */
public PollPeriodCellEditor() {
    spinner = new JSpinner(new SpinnerListModel(VALID_PERIODS));
}
项目:jnodelayout    文件:DiskVievDemo.java   
static JSpinner createSpinner() {
String[] strings = { "Zoom" };
SpinnerListModel model = new SpinnerListModel(strings);
JSpinner spinner = new JSpinner(model);
return spinner;
   }
项目:Excitement-TDMLEDA    文件:GuiRtePairsUtilities.java   
private void loadDS(File selectedFile) throws RTEMainReaderException, VisualTracingToolException
    {
        RTEMainReader reader = new DefaultRTEMainReader();
        reader.setXmlFile(selectedFile);
        reader.read();
        this.mapPairs = reader.getMapIdToPair();
        if (mapPairs.keySet().size()<1)
            throw new VisualTracingToolException("Empty pairs file (no pairs)!");

//      minPairIndex = Collections.min(this.mapPairs.keySet());
//      maxPairIndex = Collections.max(this.mapPairs.keySet());
        idsAsList = new ArrayList<Integer>(mapPairs.keySet().size());
        idsAsList.addAll(mapPairs.keySet());

        lastSelected = idsAsList.iterator().next();

        invokeLater(new Runnable()
        {
            public void run()
            {
                try
                {
                    model = new SpinnerListModel(idsAsList);
                    if (spinner!=null)
                    {
                        spinner.setModel(model);
                        spinner.setValue(lastSelected);
                        //spinner.setModel(new SpinnerNumberModel(lastSelected.intValue(), minPairIndex.intValue(), maxPairIndex.intValue(), 1));
                        spinner.setEnabled(true);
                    }
                    cpe.getQuickAccessSpinner().setModel(model);
                    cpe.getQuickAccessSpinner().setValue(lastSelected);
                    cpe.getQuickAccessSpinner().setEnabled(true);
                    cpe.setQuickAccessAllow(true);
                }
                catch(RuntimeException ex){handleError(ex, true);}
            }
        });
        datasetFileIsLoaded=true;
        if (buttonDone!=null)
        {
            this.buttonDone.setEnabled(true);
        }
    }
项目:libreveris    文件:SymbolRipper.java   
/**
 * Creates a new SymbolRipper object.
 */
public SymbolRipper ()
{
    // Related frame
    frame = new JFrame();
    frame.setTitle("Symbol Ripper");

    // Actors
    drawing = new Drawing();

    fontBase.setModel(
            new SpinnerListModel(new Integer[]{0, 0xf000, 0x1d100}));
    SpinnerUtil.setRightAlignment(fontBase);
    SpinnerUtil.fixIntegerList(fontBase);

    fontName.setModel(
            new SpinnerListModel(
            GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()));

    // Initial values
    ///fontName.getSpinner().setValue("MusicalSymbols");
    fontName.getSpinner()
            .setValue("Symbola");
    fontBase.setValue(0); //0);
    fontSize.setValue(200);
    pointCode.setModel(new SpinnerNumberModel(0x1d100, 0, 0x1d1ff, 1));
    width.setValue(400);
    height.setValue(500);
    xOffset.setValue(200);
    yOffset.setValue(300);
    changeCode();
    defineFont();

    // Listeners
    fontName.addChangeListener(paramListener);
    fontBase.addChangeListener(paramListener);
    fontSize.addChangeListener(paramListener);
    pointCode.addChangeListener(paramListener);
    hexaCode.addChangeListener(paramListener);
    xOffset.addChangeListener(paramListener);
    yOffset.addChangeListener(paramListener);
    width.addChangeListener(paramListener);
    height.addChangeListener(paramListener);

    // Global layout
    defineLayout();

    // Frame behavior
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    MainGui.getInstance()
            .show(frame);

    // Actions
    image = buildImage();
    frame.repaint();
}