javax.swing.JSpinner#getValue ( )源码实例Demo

下面列出了javax.swing.JSpinner#getValue ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: plugins   文件: ScriptInspector.java
private void addToSet(JSpinner spinner)
{
	int script = (Integer) spinner.getValue();
	Set<Integer> set = getSet();
	set.add(script);
	refreshList();
	spinner.setValue(0);
}
 
源代码2 项目: runelite   文件: ScriptInspector.java
private void addToSet(JSpinner spinner)
{
	int script = (Integer) spinner.getValue();
	Set<Integer> set = getSet();
	set.add(script);
	refreshList();
	spinner.setValue(0);
}
 
源代码3 项目: lsdpatch   文件: PaletteEditor.java
private void updateRom(int offset,
        JSpinner sr1,
        JSpinner sg1,
        JSpinner sb1,
        JSpinner sr2,
        JSpinner sg2,
        JSpinner sb2) {
    int r1 = (Integer)sr1.getValue();
    int g1 = (Integer)sg1.getValue();
    int b1 = (Integer)sb1.getValue();
    // gggrrrrr 0bbbbbgg
    romImage[offset] = (byte)(r1 | (g1 << 5));
    romImage[offset + 1] = (byte)((g1 >> 3) | (b1 << 2));

    int r2 = (Integer)sr2.getValue();
    int g2 = (Integer)sg2.getValue();
    int b2 = (Integer)sb2.getValue();
    romImage[offset + 6] = (byte)(r2 | (g2 << 5));
    romImage[offset + 7] = (byte)((g2 >> 3) | (b2 << 2));

    // Generating antialiasing colors.
    int rMid = (r1 + r2) / 2;
    int gMid = (g1 + g2) / 2;
    int bMid = (b1 + b2) / 2;
    romImage[offset + 2] = (byte)(rMid | (gMid << 5));
    romImage[offset + 3] = (byte)((gMid >> 3) | (bMid << 2));
    romImage[offset + 4] = romImage[offset + 2];
    romImage[offset + 5] = romImage[offset + 3];
}
 
源代码4 项目: wpcleaner   文件: OptionsPanel.java
/**
 * Apply new values to the integer options.
 */
private void applyInteger() {
  Configuration config = Configuration.getConfiguration();

  for (Entry<ConfigurationValueInteger, Object> entry : integerValues.entrySet()) {
    if ((entry.getValue() != null) && (entry.getKey() != null)) {
      if (entry.getValue() instanceof JSpinner) {
        JSpinner spinner = (JSpinner) entry.getValue();
        Object value = spinner.getValue();
        if (value instanceof Integer) {
          Integer intValue = (Integer) value;
          config.setInt(null, entry.getKey(), intValue.intValue());
        }
      }
      if (entry.getValue() instanceof ButtonGroup) {
        ButtonGroup group = (ButtonGroup) entry.getValue();
        int count = 0;
        Enumeration<AbstractButton> buttons = group.getElements();
        while (buttons.hasMoreElements()) {
          AbstractButton button = buttons.nextElement();
          if (group.isSelected(button.getModel())) {
            config.setInt(null, entry.getKey(), count);
          }
          count++;
        }
      }
    }
  }
}
 
源代码5 项目: btdex   文件: Welcome.java
@Override
public void actionPerformed(ActionEvent e) {
	if(e.getSource() == useLedgerButton) {

		JSpinner spinner = new JSpinner(new SpinnerNumberModel(0, 0, 128, 1));
		JPanel spinnerPannel = new JPanel(new BorderLayout());
		spinnerPannel.add(new JLabel("<html>" + tr("ledger_account_index_message")), BorderLayout.CENTER);
		spinnerPannel.add(spinner, BorderLayout.PAGE_END);
		int option = JOptionPane.showOptionDialog(this, spinnerPannel, tr("ledger_account_index"),
				JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
		if (option == JOptionPane.CANCEL_OPTION) {
			return;
		}
		int index = (Integer)spinner.getValue();
		setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
			
		LedgerService.getInstance().setCallBack(this, index);
		return;
	}
	if(e.getSource() == recoverBox) {
		if(recoverBox.isSelected()) {
			passphrase.setText("");
			passphrase.setEditable(true);
			passphrase.requestFocus();
		}
		else {
			passphrase.setEditable(false);
			newPass();
		}
		acceptBox.setSelected(recoverBox.isSelected());
		acceptBox.setEnabled(!recoverBox.isSelected());
	}
	if(e.getSource() == calcelButton) {
		ret = 0;
		setVisible(false);
	}
	if(e.getSource() == okButton) {
		String error = null;
		String phrase = passphrase.getText();

		if(!acceptBox.isSelected()) {
			error = tr("welc_write_phrase");
			acceptBox.requestFocus();
		}
		else if(phrase.length()==0) {
			error = tr("welc_phrase_empty");
			passphrase.requestFocus();				
		}
		else if(pin.getPassword() == null || pin.getPassword().length < 4) {
			error = tr("welc_min_pin");
			pin.requestFocus();
		}
		else if(!Arrays.equals(pin.getPassword(), pinCheck.getPassword())) {
			pin.requestFocus();
			error = tr("welc_wrong_pin");
		}

		if(error == null) {
			Globals g = Globals.getInstance();
			
			// no error, so we have a new phrase
			byte[] privKey = Globals.BC.getPrivateKey(phrase);
			byte[] pubKey = Globals.BC.getPublicKey(privKey);
			
			try {
				if(resetPin) {
					if(!Arrays.equals(g.getPubKey(), pubKey)) {
						error = tr("welc_wrong_phrase");
					}
				}

				if(error == null) {
					g.setKeys(pubKey, privKey, pin.getPassword());
					g.saveConfs();
				}
			} catch (Exception e1) {
				error = e1.getMessage();
			}
		}
		
		if(error!=null) {
			Toast.makeText((JFrame) this.getOwner(), error, Toast.Style.ERROR).display(okButton);
		}
		else {
			ret = 1;
			setVisible(false);
		}
	}
}