Java 类javax.swing.SpinnerNumberModel 实例源码

项目:Progetto-B    文件:AttackerDialog.java   
/**
 * Initialization.
 */
private void init() {
    Dimension dim = getToolkit().getScreenSize();
    this.setLocation(dim.width / 2 - this.getWidth() / 2, dim.height / 2 - this.getHeight() / 2);
    try {
        this.setTitle(Translator.translate("Attack", LANG, false));
    } catch (TranslationException ex) {
        this.setTitle("");
    }

    AttackerDialog attackerDialog = this;
    attackerArmies.setModel(new SpinnerNumberModel(1, 1, 1, 1));

    declare.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            PlayAudio.play("src/resources/sounds/tank.wav");
            game.setAttackerArmies((int) attackerArmies.getValue());
            attackerDialog.setVisible(false);
            game.declareAttack();
        }
    });

}
项目:openjdk-jdk10    文件:MultiGradientTest.java   
private ControlsPanel() {
    cmbPaint = createCombo(this, paintType);
    cmbPaint.setSelectedIndex(1);
    cmbCycle = createCombo(this, cycleMethod);
    cmbSpace = createCombo(this, colorSpace);
    cmbShape = createCombo(this, shapeType);
    cmbXform = createCombo(this, xformType);

    int max = COLORS.length;
    SpinnerNumberModel model = new SpinnerNumberModel(max, 2, max, 1);
    spinNumColors = new JSpinner(model);
    spinNumColors.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            numColors = ((Integer)spinNumColors.getValue()).intValue();
            gradientPanel.updatePaint();
        }
    });
    add(spinNumColors);

    cbAntialias = createCheck(this, "Antialiasing");
    cbRender = createCheck(this, "Render Quality");
}
项目:Bachelor-Thesis    文件:GUIControls.java   
/**
 * Changes the zoom level
 * @param delta How much to change the current level (can be negative or
 * positive)
 */
public void changeZoom(int delta) { 
    SpinnerNumberModel model = 
        (SpinnerNumberModel)this.zoomSelector.getModel();
    double curZoom = model.getNumber().doubleValue();
    Number newValue = new Double(curZoom + model.getStepSize().
            doubleValue() * delta * curZoom * 100); 

    if (newValue.doubleValue() < ZOOM_MIN) {
        newValue = ZOOM_MIN;
    } else if (newValue.doubleValue() > ZOOM_MAX) {
        newValue = ZOOM_MAX;
    }

    model.setValue(newValue);
    this.updateZoomScale(true);
}
项目:QN-ACTR-Release    文件:EpochPanel.java   
private void initComponents() {
    this.setLayout(new BorderLayout());
    epochs = new JSpinner(new SpinnerNumberModel(10, 10, 50, 1));
    JPanel epochOption = new JPanel(new BorderLayout());
    JPanel flowTemp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    epochs.setPreferredSize(new Dimension(70, 40));
    epochs.setFont(new Font(epochs.getFont().getName(), epochs.getFont().getStyle(), epochs.getFont().getSize() + 4));
    flowTemp.add(new JLabel("<html><body><h3>Select the maximum number of epochs: </h3></body></html> "));
    flowTemp.add(epochs);
    JButton setEpoch = new JButton(this.setEpoch);
    setEpoch.setPreferredSize(new Dimension(85, 35));
    flowTemp.add(setEpoch);
    epochOption.add(flowTemp, BorderLayout.CENTER);
    //JPanel btnPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    //btnPanel.add(setEpoch);
    //epochOption.add(btnPanel,BorderLayout.SOUTH);
    this.add(epochOption, BorderLayout.NORTH);
}
项目:KeysPerSecond    文件:Main.java   
/**
 * Shows the size configuration dialog
 */
protected static final void configureSize(){
    JPanel pconfig = new JPanel(new BorderLayout());
    JSpinner s = new JSpinner(new SpinnerNumberModel(config.size * 100, 50, Integer.MAX_VALUE, 1));
    JLabel info = new JLabel("<html>Change how big the displayed window is.<br>"
            + "The precentage specifies how big the window is in<br>"
            + "comparison to the default size of the window.<html>");
    pconfig.add(info, BorderLayout.PAGE_START);
    pconfig.add(new JSeparator(), BorderLayout.CENTER);
    JPanel line = new JPanel();
    line.add(new JLabel("Size: "));
    line.add(s);
    line.add(new JLabel("%"));
    pconfig.add(line, BorderLayout.PAGE_END);
    if(0 == JOptionPane.showOptionDialog(null, pconfig, "Keys per second", 0, JOptionPane.QUESTION_MESSAGE, null, new String[]{"OK", "Cancel"}, 0)){
        config.size = ((double)s.getValue()) / 100.0D;
    }
}
项目:intellij-randomness    文件:JLongSpinner.java   
/**
 * Constructs a new {@code JLongSpinner}.
 */
public JLongSpinner() {
    super(new SpinnerNumberModel((Long) 0L, (Long) DEFAULT_MIN_VALUE, (Long) DEFAULT_MAX_VALUE,
            (Long) DEFAULT_STEP_SIZE));

    this.minValue = DEFAULT_MIN_VALUE;
    this.maxValue = DEFAULT_MAX_VALUE;

    final JSpinner.NumberEditor editor = new JSpinner.NumberEditor(this);
    editor.getFormat().setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
    setEditor(editor);

    final Dimension minimumSize = getMinimumSize();
    minimumSize.width = SPINNER_WIDTH;
    setMinimumSize(minimumSize);

    final Dimension preferredSize = getPreferredSize();
    preferredSize.width = SPINNER_WIDTH;
    setPreferredSize(preferredSize);
}
项目:freecol    文件:IntegerOptionUI.java   
/**
 * Creates a new {@code IntegerOptionUI} for the given
 * {@code IntegerOption}.
 *
 * @param option The {@code IntegerOption} to make a user interface for.
 * @param editable boolean whether user can modify the setting
 */
public IntegerOptionUI(final IntegerOption option, boolean editable) {
    super(option, editable);

    final int value = option.getValue();
    int min = option.getMinimumValue();
    int max = option.getMaximumValue();
    if (min > max) {
        int tmp = min;
        min = max;
        max = tmp;
    }
    final int stepSize = Math.max(1, Math.min((max - min) / 10, 1000));
    this.spinner.setModel(new SpinnerNumberModel(value, min, max, 1));
    initialize();
}
项目:the-one-mdonnyk    文件:GUIControls.java   
/**
 * Changes the zoom level
 * @param delta How much to change the current level (can be negative or
 * positive)
 */
public void changeZoom(int delta) { 
    SpinnerNumberModel model = 
        (SpinnerNumberModel)this.zoomSelector.getModel();
    double curZoom = model.getNumber().doubleValue();
    Number newValue = new Double(curZoom + model.getStepSize().
            doubleValue() * delta * curZoom * 100); 

    if (newValue.doubleValue() < ZOOM_MIN) {
        newValue = ZOOM_MIN;
    } else if (newValue.doubleValue() > ZOOM_MAX) {
        newValue = ZOOM_MAX;
    }

    model.setValue(newValue);
    this.updateZoomScale(true);
}
项目:etomica    文件:DeviceSpinner.java   
private void init() {
    spinnerModel = new SpinnerNumberModel(0, 0, 500, 1);
    spinner = new JSpinner(spinnerModel);
    spinner.setFont(new java.awt.Font("",0,15));
    gbLayout = new GridBagLayout();
    gbConst = new GridBagConstraints();    
    panel = new JPanel();  
    setLabel("");
    panel.setLayout(gbLayout);
    setMinimum(0);
    setMaximum(500);
    spinner.addChangeListener(new SpinnerListener());

    gbConst.gridx = 0; gbConst.gridy = 0;
    gbLayout.setConstraints(spinner, gbConst);
    panel.add(spinner);
}
项目:trashjam2017    文件:EffectUtil.java   
/**
 * Prompts the user for int value
 * 
 * @param name The name of the dialog to show
 * @param currentValue The current value to be displayed
 * @param description The help text to provide
 * @return The value selected by the user
 */
static public Value intValue (String name, final int currentValue, final String description) {
    return new DefaultValue(name, String.valueOf(currentValue)) {
        public void showDialog () {
            JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, Short.MIN_VALUE, Short.MAX_VALUE, 1));
            if (showValueDialog(spinner, description)) value = String.valueOf(spinner.getValue());
        }

        public Object getObject () {
            return Integer.valueOf(value);
        }
    };
}
项目:trashjam2017    文件:EffectUtil.java   
/**
 * Prompts the user for float value
 * 
 * @param name The name of the dialog to show
 * @param currentValue The current value to be displayed
 * @param description The help text to provide
 * @param min The minimum value to allow
 * @param max The maximum value to allow
 * @return The value selected by the user
 */
static public Value floatValue (String name, final float currentValue, final float min, final float max,
    final String description) {
    return new DefaultValue(name, String.valueOf(currentValue)) {
        public void showDialog () {
            JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, min, max, 0.1f));
            if (showValueDialog(spinner, description)) value = String.valueOf(((Double)spinner.getValue()).floatValue());
        }

        public Object getObject () {
            return Float.valueOf(value);
        }
    };
}
项目:Bachelor-Thesis    文件:GUIControls.java   
/**
 * Updates zoom scale to the one selected by zoom chooser
 * @param centerView If true, the center of the viewport should remain
 * the same
 */
private void updateZoomScale(boolean centerView) {
    double scale = ((SpinnerNumberModel)zoomSelector.getModel()).
        getNumber().doubleValue();

    if (centerView) {
        Coord center = gui.getCenterViewCoord();
        this.pf.setScale(scale);
        gui.centerViewAt(center);
    }
    else {
        this.pf.setScale(scale);
    }
}
项目:incubator-netbeans    文件:BoxFillerInitializer.java   
WidthHeightPanel(boolean showWidth, boolean showHeight) {
    ResourceBundle bundle = NbBundle.getBundle(BoxFillerInitializer.class);
    JLabel widthLabel = new JLabel(bundle.getString("BoxFillerInitializer.width")); // NOI18N
    JLabel heightLabel = new JLabel(bundle.getString("BoxFillerInitializer.height")); // NOI18N
    widthField = new JSpinner(new SpinnerNumberModel());
    heightField = new JSpinner(new SpinnerNumberModel());
    GroupLayout layout = new GroupLayout(this);
    setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                .addComponent(widthLabel)
                .addComponent(heightLabel))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(widthField)
                .addComponent(heightField))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(widthLabel)
                .addComponent(widthField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(heightLabel)
                .addComponent(heightField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );
    widthLabel.setVisible(showWidth);
    heightLabel.setVisible(showHeight);
    widthField.setVisible(showWidth);
    heightField.setVisible(showHeight);
}
项目:incubator-netbeans    文件:XMLContentPanel.java   
@Override
protected void updateModel() {
   XMLContentAttributes contentAttr = new XMLContentAttributes(model.getPrefix());
   contentAttr.setOptionalAttributes(attributes.isSelected());
   contentAttr.setOptionalElements(elements.isSelected());

   contentAttr.setPreferredOccurences(((SpinnerNumberModel)occurSpinner.getModel()).getNumber().intValue());
   contentAttr.setDepthPreferrence(((SpinnerNumberModel)depthSpinner.getModel()).getNumber().intValue());

   model.setXMLContentAttributes(contentAttr);
   if(visible) {
       Object root = rootElementComboBox.getSelectedItem();
       model.setRoot(root == null ? null : root.toString());
   }
}
项目:incubator-netbeans    文件:XMLContentPanel.java   
@Override
protected void initView() {
   attributes.setSelected(true);
   elements.setSelected(true);

   occurencesModel = new SpinnerNumberModel(3, 0, 10, 1);
   occurSpinner.setModel(occurencesModel);

   depthModel = new SpinnerNumberModel(2, 0, 10, 1);
   depthSpinner.setModel(depthModel);

    rootModel = new DefaultComboBoxModel();
    rootElementComboBox.setModel(rootModel);       

    if(getSchemaInfo() == null)
        return;

    if(schemaInfo.roots.size() ==0){
        //TODO: should have some error message
        //String errMsg =  NbBundle.getMessage(XMLContentPanel.class, "MSG_XMLContentPanel_No_Root");
        //templateWizard.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, errMsg);
        return;
    }
    Iterator it = schemaInfo.roots.iterator();
        while (it.hasNext()) {
             String next = (String) it.next();
             rootModel.addElement(next);
        }    
}
项目:incubator-netbeans    文件:SettingsPanel.java   
private static int defaultHeight() {
    if (DEFAULT_HEIGHT == -1) {
        JPanel ref = new JPanel(null);
        ref.setLayout(new BoxLayout(ref, BoxLayout.LINE_AXIS));
        ref.setOpaque(false);

        ref.add(new JLabel("XXX")); // NOI18N

        ref.add(new JButton("XXX")); // NOI18N
        ref.add(new PopupButton("XXX")); // NOI18N

        ref.add(new JCheckBox("XXX")); // NOI18N
        ref.add(new JRadioButton("XXX")); // NOI18N

        ref.add(new JTextField("XXX")); // NOI18N

        ref.add(new JExtendedSpinner(new SpinnerNumberModel(1, 1, 655535, 1)));

        Component separator = Box.createHorizontalStrut(1);
        Dimension d = separator.getMaximumSize(); d.height = 20;
        separator.setMaximumSize(d);
        ref.add(separator);

        DEFAULT_HEIGHT = ref.getPreferredSize().height;
    }
    return DEFAULT_HEIGHT;
}
项目:openjdk-jdk10    文件:bug8008657.java   
static void createNumberSpinner() {
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.YEAR, -1);
    calendar.add(Calendar.YEAR, 1);
    int currentYear = calendar.get(Calendar.YEAR);
    SpinnerModel yearModel = new SpinnerNumberModel(currentYear, //initial value
            currentYear - 1, //min
            currentYear + 2, //max
            1);                //step
    spinner = new JSpinner();
    spinner.setModel(yearModel);
}
项目:FreeCol    文件:NegotiationDialog.java   
/**
 * Update this panel.
 *
 * @param dt The {@code DiplomaticTrade} to update with.
 */
public void update(DiplomaticTrade dt) {
    int gold = dt.getGoldGivenBy(source);
    if (gold >= 0) {
        SpinnerNumberModel model
                = (SpinnerNumberModel)spinner.getModel();
        model.setValue(gold);
    }
}
项目:scorekeeperfrontend    文件:BracketingList.java   
public BracketingList(String cname, int size)
{
    super(new MigLayout("fill"), false);

    model = new BracketingListModel();
    required = size;

    spinner = new JSpinner(new SpinnerNumberModel(size, size/2+1, size, 1));
    spinner.addChangeListener(this);

    ladiesCheck = new JCheckBox("Ladies Classes", true);
    ladiesCheck.addChangeListener(this);

    openCheck = new JCheckBox("Open Classes", true);
    openCheck.addChangeListener(this);

    bonusCheck = new JCheckBox("Bonus Style Dialins", true);        
    bonusCheck.addChangeListener(this);

    table = new JTable(model);
    table.setAutoCreateRowSorter(true);
    table.setDefaultRenderer(Double.class, new D3Renderer());
    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    table.getColumnModel().getColumn(0).setMaxWidth(50);
    table.getColumnModel().getColumn(1).setMaxWidth(200);
    table.getColumnModel().getColumn(2).setMaxWidth(200);
    table.getColumnModel().getColumn(3).setMaxWidth(75);
    table.getColumnModel().getColumn(4).setMaxWidth(75);

    mainPanel.add(new JLabel("Number of Drivers"), "split");
    mainPanel.add(spinner, "gapbottom 10, wrap");

    mainPanel.add(ladiesCheck, "wrap");
    mainPanel.add(openCheck, "wrap");
    mainPanel.add(bonusCheck, "gapbottom 10, wrap");

    mainPanel.add(new JLabel("Click on column header to sort"), "center, wrap");
    mainPanel.add(new JScrollPane(table), "width 400, height 600, grow");
}
项目:jmt    文件:EpochPanel.java   
private void initComponents() {
    this.setLayout(new BorderLayout());
    epochs = new JSpinner(new SpinnerNumberModel(10, 10, 50, 1));
    JPanel epochOption = new JPanel(new BorderLayout());
    JPanel flowTemp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    epochs.setPreferredSize(new Dimension(70, 40));
    epochs.setFont(new Font(epochs.getFont().getName(), epochs.getFont().getStyle(), epochs.getFont().getSize() + 4));
    flowTemp.add(new JLabel("<html><body><h3>Select the maximum number of epochs: </h3></body></html> "));
    flowTemp.add(epochs);
    JButton setEpoch = new JButton(this.setEpoch);
    setEpoch.setPreferredSize(new Dimension(85, 35));
    flowTemp.add(setEpoch);
    epochOption.add(flowTemp, BorderLayout.CENTER);
    this.add(epochOption, BorderLayout.NORTH);
}
项目:jmt    文件:SeedPanel.java   
public void initialize() {
    JPanel edit = new JPanel(new GridLayout(4, 1, 0, 5));
    stepsLabel = new JLabel("Steps:");
    steps = new JSpinner(new SpinnerNumberModel(SPA.getNumberOfSteps(), 2, ParametricAnalysis.MAX_STEP_NUMBER, 1));
    steps.setToolTipText("Sets the number of performed simulations");
    edit.add(stepsLabel);
    edit.add(steps);
    edit.setPreferredSize(new Dimension(130, 108));
    JPanel editLables = new JPanel(new GridLayout(4, 1, 0, 5));
    editLables.add(stepsLabel);
    editLables.setPreferredSize(new Dimension(100, 108));
    JPanel editPanel = new JPanel();
    editPanel.add(editLables);
    editPanel.add(edit);
    editPanel.setBorder(new EmptyBorder(10, 20, 0, 20));
    JPanel cont = new JPanel(new BorderLayout());
    title = new TitledBorder("Simulation seed variation");
    cont.add(editPanel, BorderLayout.CENTER);
    scroll = new JScrollPane(cont);
    scroll.setBorder(title);
    description = new JTextArea(DESCRIPTION);
    description.setOpaque(false);
    description.setEditable(false);
    description.setLineWrap(true);
    description.setWrapStyleWord(true);
    descrPane = new JScrollPane(description);
    descriptionTitle = new TitledBorder(new EtchedBorder(), "Description");
    descrPane.setBorder(descriptionTitle);
    descrPane.setMinimumSize(new Dimension(80, 0));
    scroll.setMinimumSize(new Dimension(360, 0));
    setLeftComponent(scroll);
    setRightComponent(descrPane);
    setListeners();
    this.setBorder(new EmptyBorder(5, 0, 5, 0));
}
项目:marathonv5    文件:JSpinnerJavaElementTest.java   
private JSpinner createNumberSpinner(Calendar calendar) {
    int currentYear = calendar.get(Calendar.YEAR);
    SpinnerModel yearModel = new SpinnerNumberModel(currentYear, currentYear - 100, currentYear + 100, 1);
    JSpinner numberSpinner = new JSpinner(yearModel);
    numberSpinner.setEditor(new JSpinner.NumberEditor(numberSpinner, "#"));
    numberSpinner.setName("number-spinner");
    return numberSpinner;
}
项目:Progetto-C    文件:EffectUtil.java   
/**
 * Prompts the user for int value
 * 
 * @param name The name of the dialog to show
 * @param currentValue The current value to be displayed
 * @param description The help text to provide
 * @return The value selected by the user
 */
static public Value intValue (String name, final int currentValue, final String description) {
    return new DefaultValue(name, String.valueOf(currentValue)) {
        public void showDialog () {
            JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, Short.MIN_VALUE, Short.MAX_VALUE, 1));
            if (showValueDialog(spinner, description)) value = String.valueOf(spinner.getValue());
        }

        public Object getObject () {
            return Integer.valueOf(value);
        }
    };
}
项目:Progetto-C    文件:EffectUtil.java   
/**
 * Prompts the user for float value
 * 
 * @param name The name of the dialog to show
 * @param currentValue The current value to be displayed
 * @param description The help text to provide
 * @param min The minimum value to allow
 * @param max The maximum value to allow
 * @return The value selected by the user
 */
static public Value floatValue (String name, final float currentValue, final float min, final float max,
    final String description) {
    return new DefaultValue(name, String.valueOf(currentValue)) {
        public void showDialog () {
            JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, min, max, 0.1f));
            if (showValueDialog(spinner, description)) value = String.valueOf(((Double)spinner.getValue()).floatValue());
        }

        public Object getObject () {
            return Float.valueOf(value);
        }
    };
}
项目:PMDe    文件:AreaEditor.java   
@Override
protected void initProperties() {
    setTitle("Friend area editor");

    // Initialize the components
    lblName = new JLabel("Name");
    lblNamePointer = new JLabel("Name pointer");
    lblCount = new JLabel("No. of Pokémon");
    lblCondition = new JLabel("Unlock condition");
    lblPrice = new JLabel("Price");
    txtName = new JTextField("00000000");
    txtName.setEditable(false);
    txtNamePointer = new JTextField();
    txtNamePointer.setEditable(false);
    spnCount = new JSpinner();
    spnCount.setModel(new SpinnerNumberModel(0, 0, 15, 1));
    cmoCondition = new JComboBox();
    cmoCondition.setModel(new DefaultComboBoxModel(new String[] { "0x0: Shop (Story-game)", "0x1: Shop (Post-game)", "0x2: Wonder mail event", "0x3: Legendary request" }));
    spnPrice = new JSpinner();
    spnPrice.setModel(new SpinnerNumberModel(Long.valueOf(0L), Long.valueOf(0L), Long.valueOf(99999L), Long.valueOf(1L)));

    // Add the components to the property panel
    properties.addCaption("Area settings");
    properties.addLabeledComponent(lblName, txtName);
    properties.addLabeledComponent(lblNamePointer, txtNamePointer);
    properties.addLabeledComponent(lblCount, spnCount);
    properties.addLabeledComponent(lblCondition, cmoCondition);
    properties.addLabeledComponent(lblPrice, spnPrice);
    properties.addTerminator();
}
项目:Progetto-B    文件:MoveDialog.java   
/**
 * Creates a new MoveDialog for the movement phase.
 *
 * @param game
 * @param fromCountryName
 * @param toCountryName
 */
public MoveDialog(GameProxy game, String fromCountryName, String toCountryName) {
    initComponents();
    init(game, fromCountryName, toCountryName);
    labelInfo.setText("Da " + fromCountryName + " a " + toCountryName);
    int maxArmies = game.getMaxArmiesForMovement(fromCountryName);
    movementArmies.setModel(new SpinnerNumberModel(maxArmies, 1, maxArmies, 1));
}
项目:Progetto-B    文件:MoveDialog.java   
/**
 * Creates a new MoveDialog for the movement after the attack.
 *
 * @param game
 * @param fromCountryName
 * @param toCountryName
 * @param info
 * @param minArmies
 */
public MoveDialog(GameProxy game, String fromCountryName, String toCountryName, String info, int minArmies) {
    initComponents();
    init(game, fromCountryName, toCountryName);

    this.fromCountryName = fromCountryName;
    this.toCountryName = toCountryName;
    int maxArmies = game.getMaxArmiesForMovement(fromCountryName);
    movementArmies.setModel(new SpinnerNumberModel(maxArmies, minArmies, maxArmies, 1));
    labelInfo.setText(info);
    this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
}
项目:AI-RRT-Motion-Planning    文件:Visualiser.java   
private void createComponents() {
    vp = new VisualisationPanel(this);
    JPanel wp = new JPanel(new BorderLayout());
    wp.add(vp, BorderLayout.CENTER);
    container.setLayout(new BorderLayout());
    wp.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(5, 10, 10, 10),
            BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)));
    container.add(wp, BorderLayout.CENTER);

    infoPanel = new JPanel();
    infoPanel.setLayout(new FlowLayout());

    infoLabel = new JLabel("No problem to display.");
    samplingSpinner = new JSpinner(new SpinnerNumberModel(
            SAMPLING_PERIOD_INIT, 1, null, 1));
    samplingSpinner.addChangeListener(samplingListener);
    samplingSpinner.setPreferredSize(new Dimension(50, 20));
    samplingSpinner.setVisible(false);
    vp.setSamplingPeriod(SAMPLING_PERIOD_INIT);
    infoPanel.add(infoLabel);
    infoPanel.add(samplingSpinner);

    container.add(infoPanel, BorderLayout.NORTH);

    createMenus();
    createAnimationControls();
}
项目:QN-ACTR-Release    文件:SeedPanel.java   
public void initialize() {
    JPanel edit = new JPanel(new GridLayout(4, 1, 0, 5));
    stepsLabel = new JLabel("Steps (n. of exec.): ");
    steps = new JSpinner(new SpinnerNumberModel(SPA.getNumberOfSteps(), 2, ParametricAnalysis.MAX_STEP_NUMBER, 1));
    steps.setToolTipText("Sets the number of performed simulations");
    edit.add(stepsLabel);
    edit.add(steps);
    edit.setPreferredSize(new Dimension(130, 88));
    JPanel editLables = new JPanel(new GridLayout(4, 1, 0, 5));
    editLables.add(stepsLabel);
    editLables.setPreferredSize(new Dimension(100, 88));
    JPanel editPanel = new JPanel();
    editPanel.add(editLables);
    editPanel.add(edit);
    editPanel.setBorder(new EmptyBorder(10, 20, 0, 20));
    JPanel cont = new JPanel(new BorderLayout());
    title = new TitledBorder("Simulation seed variation");
    cont.add(editPanel, BorderLayout.CENTER);
    scroll = new JScrollPane(cont);
    scroll.setBorder(title);
    description = new JTextArea(DESCRIPTION);
    description.setOpaque(false);
    description.setEditable(false);
    description.setLineWrap(true);
    description.setWrapStyleWord(true);
    descrPane = new JScrollPane(description);
    descriptionTitle = new TitledBorder(new EtchedBorder(), "Description");
    descrPane.setBorder(descriptionTitle);
    descrPane.setMinimumSize(new Dimension(80, 0));
    scroll.setMinimumSize(new Dimension(360, 0));
    setLeftComponent(scroll);
    setRightComponent(descrPane);
    setListeners();
    this.setBorder(new EmptyBorder(5, 0, 5, 0));
}
项目:GIFKR    文件:ViewUtils.java   
public static JPanel createLabelField(String preText, String postText, JSlider s) {
    JPanel p = new JPanel();

    JSpinner spin = new JSpinner(new SpinnerNumberModel(s.getValue(), s.getMinimum(), s.getMaximum(), 1));
    spin.addChangeListener(ce -> {s.setValue((Integer) spin.getValue());});
    p.add(new JLabel(preText));
    p.add(spin);
    p.add(new JLabel(postText));

    return p;
}
项目:GIFKR    文件:SaveFrame.java   
public void initializeComponents() {
    widthSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 99999, 100));
    heightSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 99999, 100));
    frameDelayLabel = new JLabel("Frame delay (ms):");
    frameDelaySpinner = new JSpinner(new SpinnerNumberModel(0, 0, 99999, 1));

    chooser = new JFileChooser();
    chooser.setDialogType(JFileChooser.SAVE_DIALOG);
    chooser.setAcceptAllFileFilterUsed(false);
    //setAnimationMode(true);
    //      chooser.setSelectedFile(StringUtil.resolveConflictName(chooser.getSelectedFile(), "glitch", true));
}
项目:GIFKR    文件:MatrixInterpolator.java   
private void initializeComponents() {
    this.rows = new JSpinner(new SpinnerNumberModel(elements[0].length, 1, 999, 2));
    this.cols = new JSpinner(new SpinnerNumberModel(elements.length, 1, 999, 2));

    manualButton = new JButton("Define matrix");

    matrixP = new JPanel();
    refreshMatrixPanel();
}
项目:Dise-o-2017    文件:IUGestionarTipoImpuestoModificacionItem.java   
public IUGestionarTipoImpuestoModificacionItem(String nombreItem, String cuitEmpresa, int codigoTipoImpuesto,String nombreTipoEmpresa, int ordenItem) {
    initComponents();
    this.setLocationRelativeTo(null);
    this.nombreTipoEmpresa = nombreTipoEmpresa;
    this.codigoTipoImpuesto = codigoTipoImpuesto;
    this.cuitEmpresa = cuitEmpresa;
    this.ordenAnterior = ordenItem;
    jTextField_ItemNombre.setText(nombreItem);
    SpinnerNumberModel sf = new SpinnerNumberModel();
    sf.setMinimum(0);
    sf.setValue(ordenItem);
    spinner_Orden.setModel(sf);
}
项目:JavaGraph    文件:ExploreWarningDialog.java   
private SpinnerNumberModel getBoundSpinnerModel() {
    if (this.boundSpinnerModel == null) {
        this.boundSpinnerModel = new SpinnerNumberModel();
        this.boundSpinnerModel.setValue(100000);
        this.boundSpinnerModel.setStepSize(100);
    }
    return this.boundSpinnerModel;
}
项目:JavaGraph    文件:NumberDialog.java   
/** Returns the text field in which the user is to enter his input. */
private JSpinner getNumberField() {
    if (this.numberField == null) {
        this.numberField = new JSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1));
        this.numberField.setPreferredSize(new Dimension(50,
            this.numberField.getPreferredSize().height));
    }
    return this.numberField;
}
项目:JavaGraph    文件:LayoutKind.java   
MySpinner(Method methodToCall, JGraphLayout layout, LayouterItem item, double value,
    double min, double max, double step) {
    super(new SpinnerNumberModel(value, min, max, step));
    this.methodToCall = methodToCall;
    this.layout = layout;
    this.item = item;
}
项目:Equella    文件:ProxyDetailsDialog.java   
private void setupOverall()
{
    setupCredentials();

    JLabel hostLabel = new JLabel("Proxy Host:");
    JLabel portLabel = new JLabel("Proxy Port:");

    hostField = new JTextField();
    hostField.addKeyListener(this);

    portModel = new SpinnerNumberModel(PROXY_DEFAULT, PROXY_MIN, PROXY_MAX, PROXY_STEP);
    JSpinner portSpinner = new JSpinner(portModel);

    final int width1 = hostLabel.getPreferredSize().width;
    final int width2 = portSpinner.getPreferredSize().width;
    final int height1 = hostField.getPreferredSize().height;
    final int height2 = credentials.getPreferredSize().height;
    final int[] rows = {height1, height1, height2,};
    final int[] cols = {width1, width2, TableLayout.FILL,};

    overall = new JGroup("Enable Proxy", false);
    overall.addActionListener(this);
    overall.setInnerLayout(new TableLayout(rows, cols));

    overall.addInner(hostLabel, new Rectangle(0, 0, 1, 1));
    overall.addInner(hostField, new Rectangle(1, 0, 2, 1));
    overall.addInner(portLabel, new Rectangle(0, 1, 1, 1));
    overall.addInner(portSpinner, new Rectangle(1, 1, 1, 1));
    overall.addInner(credentials, new Rectangle(0, 2, 3, 1));

    overall.setSelected(false);
}
项目:BaseClient    文件:EffectUtil.java   
/**
 * Prompts the user for int value
 * 
 * @param name The name of the dialog to show
 * @param currentValue The current value to be displayed
 * @param description The help text to provide
 * @return The value selected by the user
 */
static public Value intValue (String name, final int currentValue, final String description) {
    return new DefaultValue(name, String.valueOf(currentValue)) {
        public void showDialog () {
            JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, Short.MIN_VALUE, Short.MAX_VALUE, 1));
            if (showValueDialog(spinner, description)) value = String.valueOf(spinner.getValue());
        }

        public Object getObject () {
            return Integer.valueOf(value);
        }
    };
}
项目:FreeCol    文件:NegotiationDialog.java   
/**
 * Creates a new {@code GoldTradeItemPanel} instance.
 *
 * @param source The {@code Player} that is trading.
 * @param gold The maximum amount of gold to trade.
 */
public GoldTradeItemPanel(Player source, int gold) {
    this.source = source;
    this.spinner = new JSpinner(new SpinnerNumberModel(0, 0, gold, 1));
    JButton clearButton = Utility.localizedButton("negotiationDialog.clear");
    clearButton.addActionListener(this);
    clearButton.setActionCommand(CLEAR);
    JButton addButton = Utility.localizedButton("negotiationDialog.add");
    addButton.addActionListener(this);
    addButton.setActionCommand(ADD);
    // adjust entry size
    ((JSpinner.DefaultEditor)this.spinner.getEditor())
                                         .getTextField()
                                         .setColumns(5);

    setBorder(Utility.SIMPLE_LINE_BORDER);
    setLayout(new MigLayout("wrap 1", "", ""));

    add(Utility.localizedLabel(Messages.getName("model.tradeItem.gold")));
    add(Utility.localizedLabel(StringTemplate
            .template("negotiationDialog.goldAvailable")
            .addAmount("%amount%", gold)));
    add(this.spinner);
    add(clearButton, "split 2");
    add(addButton);

    setSize(getPreferredSize());
}
项目:ramus    文件:TestFrame.java   
private Container createContentPanel() {
    final JPanel panel = new JPanel() {

        @Override
        public void paint(Graphics g) {
            super.paint(g);
            model.paint((Graphics2D) g, this.getBounds());
        }
    };

    final JPanel res = new JPanel(new BorderLayout());
    res.add(panel, BorderLayout.CENTER);
    final JSpinner slider = new JSpinner(
            new SpinnerNumberModel(4, 2, 8, 1) {

            });
    res.add(slider, BorderLayout.SOUTH);
    slider.addChangeListener(new ChangeListener() {

        public void stateChanged(final ChangeEvent e) {
            model.setCount(((Number) slider.getValue()).intValue());
            TestFrame.this.repaint();
        }

    });
    return res;
}