当前位置: 首页>>代码示例>>Java>>正文


Java JSpinner类代码示例

本文整理汇总了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);
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:22,代码来源:SatelliteMultiViewerCorner.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:OLCustomizer.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:ULCustomizer.java

示例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) {
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:TABLECustomizer.java

示例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()); 
	
}
 
开发者ID:fossasia,项目名称:zooracle,代码行数:13,代码来源:ComparePanel.java

示例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);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:22,代码来源:StorageSectionPanel.java

示例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();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:22,代码来源:JSpinnerJavaElementTest.java

示例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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:13,代码来源:JSpinnerJavaElementTest.java

示例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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:27,代码来源:RComponentFactory.java

示例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;
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:23,代码来源:EffectUtil.java

示例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()));
			}
		}
	});
}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:19,代码来源:TimelinePartPanel.java

示例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;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:18,代码来源:GenericListener.java

示例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);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:19,代码来源:EpochPanel.java

示例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);
		}
	};
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:21,代码来源:EffectUtil.java

示例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);
		}
	};
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:24,代码来源:EffectUtil.java


注:本文中的javax.swing.JSpinner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。