本文整理汇总了Java中javax.swing.SpinnerModel类的典型用法代码示例。如果您正苦于以下问题:Java SpinnerModel类的具体用法?Java SpinnerModel怎么用?Java SpinnerModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpinnerModel类属于javax.swing包,在下文中一共展示了SpinnerModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDateSpinner
import javax.swing.SpinnerModel; //导入依赖的package包/类
static void createDateSpinner() {
Calendar calendar = Calendar.getInstance();
Date initDate = calendar.getTime();
calendar.add(Calendar.YEAR, -1);
Date earliestDate = calendar.getTime();
calendar.add(Calendar.YEAR, 1);
Date latestDate = calendar.getTime();
SpinnerModel dateModel = new SpinnerDateModel(initDate,
earliestDate,
latestDate,
Calendar.YEAR);
spinner = new JSpinner();
spinner.setModel(dateModel);
}
示例2: BackupView
import javax.swing.SpinnerModel; //导入依赖的package包/类
public BackupView() {
setLayout( new BorderLayout() );
add( new FormPanel( "backups.jfrm" ), BorderLayout.CENTER );
SpinnerModel model = new SpinnerNumberModel(30, 1, 120, 1 );
getSpinner(ID_BACKUP_PERIOD).setModel(model);
setController( new BackupViewController(this) );
setUIDirector( new BackupViewUIDirector() );
model.setValue( AppProperties.getIntProperty( ID_BACKUP_PERIOD, 30 ) );
setText(ID_BACKUP_LOCATION, AppProperties.getProperty( ID_BACKUP_LOCATION));
setSelected( ID_AUTOMATIC_BACKUPS, "true".equals(AppProperties.getProperty( ID_AUTOMATIC_BACKUPS)));
setVisible(ID_BACKUP_MESSAGE, false );
updateComponents(null);
}
示例3: createSpinner
import javax.swing.SpinnerModel; //导入依赖的package包/类
/**
* Helper method to create a JSpinner.
*
* @param range the range of the spinner
* @param dtype data type. One of the DTYPE_XXX constants defined in
* com.korilog.kform.core.Item.
*/
private JSpinner createSpinner(Range range, int dtype){
JSpinner spin;
SpinnerModel model;
if (dtype==Item.DTYPE_INT){
model = new SpinnerNumberModel(
((IntRange)range).getRangeDef(),
((IntRange)range).getRangeFrom(),
((IntRange)range).getRangeTo(),
1);
}
else{
model = new SpinnerNumberModel(
((DoubleRange)range).getRangeDef(),
((DoubleRange)range).getRangeFrom(),
((DoubleRange)range).getRangeTo(),
1);
}
spin= new JSpinner(model);
return spin;
}
示例4: createWidthPanel
import javax.swing.SpinnerModel; //导入依赖的package包/类
/**
* This method creates and return the panel of the width. It used for the
* stroke elements and contains the unit panel.
*
* @param width
* the width of the stroke of the style to be modified.
* @param unit
* the unit of the style to be modified.
* @return the panel of the width.
*/
public JPanel createWidthPanel(double width, String unit) {
JLabel lblWidth = new JLabel(I18N.getString("StyleEditionFrame.Width")); //$NON-NLS-1$
SpinnerModel model = new SpinnerNumberModel(width, // initial value
0d, // min
1000d, // max
0.5d);
JSpinner spinner = new JSpinner(model);
spinner.addChangeListener(this);
JPanel widthPanel = new JPanel();
widthPanel.add(lblWidth);
widthPanel.add(spinner);
widthPanel.add(this.createUnitPanel(unit));
return widthPanel;
}
示例5: createSizePanel
import javax.swing.SpinnerModel; //导入依赖的package包/类
/**
* This method creates and return the panel of the size of a point symbol.
*
* @param size
* the size of the style to be modified.
* @return the panel of the size of a point symbol.
*/
public JPanel createSizePanel(float size) {
JLabel lblSize = new JLabel(I18N.getString("StyleEditionFrame.Size")); //$NON-NLS-1$
SpinnerModel model = new SpinnerNumberModel(size, // initial value
0f, // min
1000f, // max
0.5f);
JSpinner spinner = new JSpinner(model);
spinner.addChangeListener(this);
JPanel sizePanel = new JPanel();
sizePanel.add(lblSize);
sizePanel.add(spinner);
return sizePanel;
}
示例6: NumberParamValuePanel
import javax.swing.SpinnerModel; //导入依赖的package包/类
public NumberParamValuePanel(Parameter parameter) {
super();
final String type = parameter.getValue().getType();
final Parameter curParam = parameter;
SpinnerModel model = new SpinnerNumberModel(1, 0, 100, 1);
JSpinner spinner = new JSpinner(model);
mParaValueBox = spinner;
parameter.setValue(type, Integer.toString(0));
mParaValueBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
//System.out.println("Setting value of parameter to: " + mParaValueBox.getModel().getValue());
curParam.setValue(type, Integer.toString((Integer) mParaValueBox.getModel().getValue()));
}
});
this.add(mParaValueBox);
}
示例7: getBlackThresholdModel
import javax.swing.SpinnerModel; //导入依赖的package包/类
public static SpinnerModel getBlackThresholdModel(Scanner scanner) {
SpinnerNumberModel blackThresholdModel = new SpinnerNumberModel(0, MIN_BLACK_THRESHOLD,
MAX_BLACK_THRESHOLD, 1);
HashMap<String, FixedOption> fixedOptions = scanner.getFixedOptions();
FixedOption fixedOption = fixedOptions.get(SANE_NAME_THRESHOLD);
if (fixedOption == null) {
return null;
}
Constraints constraints = fixedOption.getConstraints();
Integer maxInt = constraints.getMaximumInteger();
Integer minInt = constraints.getMinimumInteger();
blackThresholdModel.setMaximum(maxInt);
blackThresholdModel.setMinimum(minInt);
blackThresholdModel.setStepSize(constraints.getQuantumInteger());
blackThresholdModel.setValue(fixedOption.getValue());
return blackThresholdModel;
}
示例8: createGlobalSettingsPanel
import javax.swing.SpinnerModel; //导入依赖的package包/类
/**
* Creates the panel for the global settings.
*/
private void createGlobalSettingsPanel() {
globalSettingsPanel = new JPanel();
globalSettingsPanel.setLayout(new FlowLayout());
JLabel minSimilarityLabel = new JLabel(MIN_SIMILARITY_LABEL);
SpinnerModel spinnerModel = new SpinnerNumberModel(
GUIAutomation.DEFAULT_MIN_SIMILARITY,
GUIAutomation.MIN_SIMILARITY_MIN_VALUE,
GUIAutomation.MIN_SIMILARITY_MAX_VALUE,
MIN_SIMILARITY_STEP_SIZE);
minSimilaritySpinner = new JSpinner(spinnerModel);
minSimilaritySpinner.setName(NAME_MIN_SIMILARITY_SPINNER);
globalSettingsPanel.add(minSimilarityLabel);
globalSettingsPanel.add(minSimilaritySpinner);
}
示例9: makeDate
import javax.swing.SpinnerModel; //导入依赖的package包/类
private static JSpinner makeDate(Controller c, String source,
GridBagLayout gbl, GridBagConstraints con) {
JSpinner dt = new JSpinner();
SpinnerModel sm = new SpinnerDateModel();
dt.setModel(sm);
JSpinner.DateEditor editor = (JSpinner.DateEditor)dt.getEditor();
JTextField txt = editor.getTextField();
txt.setForeground(Color.WHITE);
txt.setBackground(new Color(55, 55, 55));
txt.setCaretColor(Color.WHITE);
gbl.setConstraints(dt, con);
if (source.startsWith("#")) {
c.bind(dt, source.substring(1));
} else {
dt.setValue(source);
}
return dt;
}
示例10: loadComboBoxes
import javax.swing.SpinnerModel; //导入依赖的package包/类
private void loadComboBoxes() {
//cargar lista de modelos en jcombobox
this.comboModel.removeAllItems();
String modelPreCombo = bt.getSpreadModelName();
for (String spm : SpreadModel.getListOfModels()) {
this.comboModel.addItem(spm);
}
this.comboModel.setSelectedItem(modelPreCombo);
//cargar lista de modelos en jcombobox de centrality
this.comboModel2.removeAllItems();
this.comboModel2.addItem("betwenness");
this.comboModel2.addItem("closeness");
this.comboModel2.addItem("degree");
this.comboModel2.addItem("random");
this.comboModel2.setSelectedItem("betwenness");
SpinnerModel model = new SpinnerNumberModel(10, 1, bt.getNumUsers(), 1);
nagents.setModel(model);
}
示例11: scaleSpinnerModel
import javax.swing.SpinnerModel; //导入依赖的package包/类
@Override
public SpinnerModel scaleSpinnerModel(MapSubView subView)
{
GrainMagnitudeSubView gms = (GrainMagnitudeSubView)subView;
float grainVal;
float maxVal = 0;
for (Grain g : GrainUtil.getGrains(grainModel))
{
grainVal = (float) gms.select(new double[]{g.magMin, g.magMax, g.magAvg});
maxVal = Math.max(grainVal, maxVal);
}
maxVal = (int)(maxVal * 10);
maxVal /= 10f;
return new SpinnerNumberModel(maxVal, 0.0, 180.0, 0.1);
}
示例12: getSpinnerModels
import javax.swing.SpinnerModel; //导入依赖的package包/类
private SpinnerModel[] getSpinnerModels()
{
SpinnerModel[] spinnermodel = new SpinnerModel[4];
long ct = current_time;
for(int i = 0; i < 4; i++)
{
int max = (int) Math.floor(video_duration / devisions[i]);
max = max < maxes[i] || max == 0 ? max : maxes[i];
int cur = 0;
while(ct > devisions[i])
{
ct -= devisions[i];
cur++;
}
spinnermodel[i] = new SpinnerNumberModel(cur,0, max, 1);
}
return spinnermodel;
}
示例13: createElements
import javax.swing.SpinnerModel; //导入依赖的package包/类
private void createElements()
{
SpinnerModel[] models = getSpinnerModels();
hour_spinner = new JSpinner(models[0]);
minute_spinner = new JSpinner(models[1]);
second_spinner = new JSpinner(models[2]);
millisecond_spinner = new JSpinner(models[3]);
lblH = new JLabel("H");
lblM = new JLabel("M");
lblS = new JLabel("S");
lblMs = new JLabel("mS");
btnGo = new JButton("Go to time");
btnGo.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
vc.setMediaTime(getSelectedTime());
}
});
}
示例14: addNumberSpinner
import javax.swing.SpinnerModel; //导入依赖的package包/类
private void addNumberSpinner(final Element svgElement, JPanel sidePanel, String labelString, final String attributeString, int minValue, int maxValue) {
int initialValue = 0;
try {
final String initialValueString = svgElement.getAttribute(attributeString).trim();
if (initialValueString.length() > 0) {
initialValue = Integer.decode(initialValueString);
}
} catch (NumberFormatException exception) {
BugCatcherManager.getBugCatcher().logError(exception);
}
sidePanel.add(new JLabel(labelString));
SpinnerModel spinnerModel =
new SpinnerNumberModel(initialValue, minValue, maxValue, 1);
final JSpinner numberSpinner = new JSpinner(spinnerModel);
numberSpinner.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
updateValue(svgElement, attributeString, numberSpinner.getValue().toString());
}
});
sidePanel.add(numberSpinner);
}
示例15: clearGridButtonActionPerformed
import javax.swing.SpinnerModel; //导入依赖的package包/类
private void clearGridButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearGridButtonActionPerformed
reactor.clearGrid();
for (int i = 0; i < reactorButtons.length; i++) {
for (int j = 0; j < reactorButtons[i].length; j++) {
reactorButtons[i][j].setIcon(null);
reactorButtons[i][j].setToolTipText(null);
reactorButtonPanels[i][j].setBackground(Color.LIGHT_GRAY);
}
}
outputArea.setText(null);
materialsArea.setText(reactor.getMaterials().toString());
componentListArea.setText(reactor.getComponentList().toString());
maxHeatLabel.setText(String.format("/%,.0f", reactor.getMaxHeat()));
temperatureEffectsLabel.setText(String.format("Burn: %,d Evaporate: %,d Hurt: %,d Lava: %,d Explode: %,d", (int)(reactor.getMaxHeat() * 0.4), (int)(reactor.getMaxHeat() * 0.5), (int)(reactor.getMaxHeat() * 0.7), (int)(reactor.getMaxHeat() * 0.85), (int)(reactor.getMaxHeat() * 1.0)));
SpinnerModel model = heatSpinner.getModel();
if (model instanceof SpinnerNumberModel) {
((SpinnerNumberModel) model).setMaximum(reactor.getMaxHeat());
}
changingCode = true;
codeField.setText(null);
changingCode = false;
}