本文整理汇总了Java中javax.swing.JSpinner类的典型用法代码示例。如果您正苦于以下问题:Java JSpinner类的具体用法?Java JSpinner怎么用?Java JSpinner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JSpinner类属于javax.swing包,在下文中一共展示了JSpinner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SatelliteMultiViewerCorner
import javax.swing.JSpinner; //导入依赖的package包/类
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);
}
示例2: OLCustomizer
import javax.swing.JSpinner; //导入依赖的package包/类
/**
* Creates new form OLCustomizer
*/
public OLCustomizer(OL ol) {
this.ol = ol;
initComponents();
try {
((JSpinner.NumberEditor)jSpinner1.getEditor()).getTextField().getAccessibleContext().setAccessibleName(jSpinner1.getAccessibleContext().getAccessibleName());
((JSpinner.NumberEditor)jSpinner1.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(jSpinner1.getAccessibleContext().getAccessibleDescription());
}catch (Exception e) {
}
if (ol.getType().equals(OL.DEFAULT))
jRadioButton1.setSelected(true);
else if (ol.getType().equals(OL.ARABIC_NUMBERS))
jRadioButton2.setSelected(true);
else if (ol.getType().equals(OL.LOWER_ALPHA))
jRadioButton3.setSelected(true);
else if (ol.getType().equals(OL.UPPER_ALPHA))
jRadioButton4.setSelected(true);
else if (ol.getType().equals(OL.LOWER_ROMAN))
jRadioButton5.setSelected(true);
else if (ol.getType().equals(OL.UPPER_ROMAN))
jRadioButton6.setSelected(true);
}
示例3: ULCustomizer
import javax.swing.JSpinner; //导入依赖的package包/类
/**
* Creates new form ULCustomizer
*/
public ULCustomizer(UL ul) {
this.ul = ul;
initComponents();
try {
((JSpinner.NumberEditor)jSpinner1.getEditor()).getTextField().getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(ULCustomizer.class,"ACSN_UL_Items_Spinner"));
((JSpinner.NumberEditor)jSpinner1.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ULCustomizer.class,"ACSD_UL_Items_Spinner"));
}catch (Exception e) {
}
if (ul.getType().equals(UL.DEFAULT))
jRadioButton1.setSelected(true);
else if (ul.getType().equals(UL.DISC))
jRadioButton2.setSelected(true);
else if (ul.getType().equals(UL.CIRCLE))
jRadioButton3.setSelected(true);
else if (ul.getType().equals(UL.SQUARE))
jRadioButton4.setSelected(true);
}
示例4: TABLECustomizer
import javax.swing.JSpinner; //导入依赖的package包/类
/** Creates new form TABLE_1Panel */
public TABLECustomizer(TABLE table) {
this.table = table;
initComponents();
try {
((JSpinner.NumberEditor)jSpinner1.getEditor()).getTextField().getAccessibleContext().setAccessibleName(jSpinner1.getAccessibleContext().getAccessibleName());
((JSpinner.NumberEditor)jSpinner1.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(jSpinner1.getAccessibleContext().getAccessibleDescription());
((JSpinner.NumberEditor)jSpinner2.getEditor()).getTextField().getAccessibleContext().setAccessibleName(jSpinner2.getAccessibleContext().getAccessibleName());
((JSpinner.NumberEditor)jSpinner2.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(jSpinner2.getAccessibleContext().getAccessibleDescription());
((JSpinner.NumberEditor)jSpinner3.getEditor()).getTextField().getAccessibleContext().setAccessibleName(jSpinner3.getAccessibleContext().getAccessibleName());
((JSpinner.NumberEditor)jSpinner3.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(jSpinner3.getAccessibleContext().getAccessibleDescription());
((JSpinner.NumberEditor)jSpinner4.getEditor()).getTextField().getAccessibleContext().setAccessibleName(jSpinner4.getAccessibleContext().getAccessibleName());
((JSpinner.NumberEditor)jSpinner4.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(jSpinner4.getAccessibleContext().getAccessibleDescription());
((JSpinner.NumberEditor)jSpinner5.getEditor()).getTextField().getAccessibleContext().setAccessibleName(jSpinner5.getAccessibleContext().getAccessibleName());
((JSpinner.NumberEditor)jSpinner5.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(jSpinner5.getAccessibleContext().getAccessibleDescription());
((JSpinner.NumberEditor)widthSpinner.getEditor()).getTextField().getAccessibleContext().setAccessibleName(widthSpinner.getAccessibleContext().getAccessibleName());
((JSpinner.NumberEditor)widthSpinner.getEditor()).getTextField().getAccessibleContext().setAccessibleDescription(widthSpinner.getAccessibleContext().getAccessibleDescription());
} catch (Exception e) {
}
}
示例5: ComparePanel
import javax.swing.JSpinner; //导入依赖的package包/类
public ComparePanel()
{
dateSpinner = new JSpinner( new SpinnerDateModel() );
JSpinner.DateEditor dateEditor = new JSpinner.DateEditor(dateSpinner, "dd.MM.yyyy");
dateSpinner.setEditor(dateEditor);
dateSpinner.setValue(new Date());
timeSpinner = new JSpinner( new SpinnerDateModel() );
JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, "HH:mm:ss");
timeSpinner.setEditor(timeEditor);
timeSpinner.setValue(new Date());
}
示例6: initComponents
import javax.swing.JSpinner; //导入依赖的package包/类
private void initComponents() {
setLayout(new BorderLayout(5, 5));
setBorder(new EmptyBorder(5, 5, 5, 5));
capacitySpinner = new JSpinner();
capacitySpinner.setPreferredSize(DIM_BUTTON_XS);
infiniteCheckBox = new JCheckBox("Infinite");
JPanel capacityPanel = new JPanel();
capacityPanel.setBorder(new TitledBorder(new EtchedBorder(), "Storage Capacity"));
capacityPanel.add(new JLabel("Capacity: "));
capacityPanel.add(capacitySpinner);
capacityPanel.add(infiniteCheckBox);
optionTable = new StorageOptionTable();
JPanel optionPanel = new JPanel(new BorderLayout());
optionPanel.setBorder(new TitledBorder(new EtchedBorder(), "Storage Options"));
optionPanel.add(new WarningScrollTable(optionTable, WARNING_CLASS));
add(capacityPanel, BorderLayout.NORTH);
add(optionPanel, BorderLayout.CENTER);
}
示例7: showDialog
import javax.swing.JSpinner; //导入依赖的package包/类
@BeforeMethod public void showDialog() throws Throwable {
SwingUtilities.invokeAndWait(new Runnable() {
@Override public void run() {
frame = new JFrame("My Dialog");
frame.setName("dialog-1");
JSpinner listSpinner = createListSpinner();
Calendar calendar = Calendar.getInstance();
JSpinner numberSpinner = createNumberSpinner(calendar);
JSpinner dateSpinner = createDateSpinner(calendar);
frame.setLayout(new FlowLayout());
frame.getContentPane().add(listSpinner);
frame.getContentPane().add(numberSpinner);
frame.getContentPane().add(dateSpinner);
frame.pack();
frame.setAlwaysOnTop(true);
frame.setVisible(true);
}
});
driver = new JavaAgent();
}
示例8: createDateSpinner
import javax.swing.JSpinner; //导入依赖的package包/类
private JSpinner createDateSpinner(Calendar calendar) {
Date initDate = calendar.getTime();
calendar.add(Calendar.YEAR, -100);
Date earliestDate = calendar.getTime();
calendar.add(Calendar.YEAR, 200);
Date latestDate = calendar.getTime();
SpinnerDateModel spinnerDateModel = new SpinnerDateModel(initDate, earliestDate, latestDate, Calendar.YEAR);
JSpinner dateSpinner = new JSpinner(spinnerDateModel);
dateSpinner.setEditor(new JSpinner.DateEditor(dateSpinner, "MM/yyyy"));
dateSpinner.setName("date-spinner");
return dateSpinner;
}
示例9: reset
import javax.swing.JSpinner; //导入依赖的package包/类
public static void reset() {
entries.clear();
add(Component.class, RUnknownComponent.class);
add(Window.class, RWindow.class);
add(JTable.class, RTable.class);
add(JTableHeader.class, RTableHeader.class);
add(AbstractButton.class, RAbstractButton.class);
add(JToggleButton.class, RToggleButton.class);
add(JComboBox.class, RComboBox.class);
add(JTextComponent.class, RTextComponent.class);
add(JTree.class, RTree.class);
add(JList.class, RList.class);
add(JTabbedPane.class, RTabbedPane.class);
add(JMenuItem.class, RMenuItem.class);
add(JSlider.class, RSlider.class);
add(JProgressBar.class, RProgressBar.class);
add(JSpinner.class, RSpinner.class);
add(DefaultEditor.class, RDefaultEditor.class);
add(JColorChooser.class, RColorChooser.class);
add(JSplitPane.class, RSplitPane.class);
add(BasicSplitPaneDivider.class, RSplitPane.class);
add(JFileChooser.class, RFileChooser.class);
add(JEditorPane.class, REditorPane.class);
add(JLabel.class, RLabel.class);
add(JScrollBar.class, RIgnoreComponent.class);
}
示例10: showValueDialog
import javax.swing.JSpinner; //导入依赖的package包/类
/**
* Prompt the user for a value
*
* @param component The component to use as parent for the prompting dialog
* @param description The description of the value being prompted for
* @return True if the value was configured
*/
public boolean showValueDialog(final JComponent component, String description) {
ValueDialog dialog = new ValueDialog(component, name, description);
dialog.setTitle(name);
dialog.setLocationRelativeTo(null);
EventQueue.invokeLater(new Runnable() {
public void run () {
JComponent focusComponent = component;
if (focusComponent instanceof JSpinner)
focusComponent = ((JSpinner.DefaultEditor)((JSpinner)component).getEditor()).getTextField();
focusComponent.requestFocusInWindow();
}
});
dialog.setVisible(true);
return dialog.okPressed;
}
示例11: PartSpinner
import javax.swing.JSpinner; //导入依赖的package包/类
private PartSpinner(int dimension) {
super(new PartSpinnerModel());
this.dimension = dimension;
setupFilter();
addChangeListener(new ChangeListener(){
@Override
public void stateChanged(ChangeEvent e) {
Part part = controller.getSelectedPart();
PartSpinner spinner = (PartSpinner) e.getSource();
if(part != null && ((JSpinner.DefaultEditor)getEditor()).getTextField().hasFocus()) {
double d = (double) spinner.getValue();
float[] prevValues = part.getValues();
part.setValue((float) d, dimension);
controller.mainController.versionController.applyChange(new ChangeSetValues(prevValues, part.getValues(), part.getName(), (int) controller.getTime()));
}
}
});
}
示例12: accept
import javax.swing.JSpinner; //导入依赖的package包/类
protected boolean accept(Component jc) {
if (extListener != null && extListener.accept(jc)) {
return true;
}
if (!(jc instanceof JComponent)) {
return false;
}
return isProbablyAContainer (jc) ||
jc instanceof JList ||
jc instanceof JComboBox ||
jc instanceof JTree ||
jc instanceof JToggleButton || //covers toggle, radio, checkbox
jc instanceof JTextComponent ||
jc instanceof JColorChooser ||
jc instanceof JSpinner ||
jc instanceof JSlider;
}
示例13: initComponents
import javax.swing.JSpinner; //导入依赖的package包/类
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);
}
示例14: intValue
import javax.swing.JSpinner; //导入依赖的package包/类
/**
* 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);
}
};
}
示例15: floatValue
import javax.swing.JSpinner; //导入依赖的package包/类
/**
* 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);
}
};
}