javax.swing.JSpinner.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(12.6k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中javax.swing.JSpinner.<init>()方法的一些代码示例,展示了JSpinner.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSpinner.<init>()方法的具体详情如下:
包路径:javax.swing.JSpinner
类名称:JSpinner
方法名:<init>

JSpinner.<init>介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

private void initializeComponents () {
    JPanel contentPanel = getContentPanel();
    {
      JLabel label = new JLabel("Value:");
      contentPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
        new Insets(0, 0, 0, 6), 0, 0));
    }
    {
      valueSpinner = new JSpinner(new SpinnerNumberModel(new Float(0), new Float(-99999), new Float(99999), new Float(0.1f)));
      contentPanel.add(valueSpinner, new GridBagConstraints(1, 1, 1, 1, 1, 0, GridBagConstraints.WEST,
        GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    }
  }
}

代码示例来源:origin: libgdx/libgdx

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());
}

代码示例来源:origin: kiegroup/optaplanner

private JPanel createFormPanel() {
  JPanel formPanel = new JPanel(new GridLayout(0, 2, 5, 5));
  formPanel.add(new JLabel("2 exams in a row penalty"));
  twoInARowPenaltyField = new JSpinner(new SpinnerNumberModel(0, 0, null, 1));
  formPanel.add(twoInARowPenaltyField);
  formPanel.add(new JLabel("2 exams in a day penalty"));
  twoInADayPenaltyField = new JSpinner(new SpinnerNumberModel(0, 0, null, 1));
  formPanel.add(twoInADayPenaltyField);
  formPanel.add(new JLabel("Period spread length"));
  periodSpreadLengthField = new JSpinner(new SpinnerNumberModel(0, 0, null, 1));
  formPanel.add(periodSpreadLengthField);
  formPanel.add(new JLabel("Period spread penalty"));
  periodSpreadPenaltyField = new JSpinner(new SpinnerNumberModel(0, 0, null, 1));
  formPanel.add(periodSpreadPenaltyField);
  formPanel.add(new JLabel("Exams of mixed duration penalty"));
  mixedDurationPenaltyField = new JSpinner(new SpinnerNumberModel(0, 0, null, 1));
  formPanel.add(mixedDurationPenaltyField);
  formPanel.add(new JLabel("Front load: large exam size"));
  frontLoadLargeTopicSizeField = new JSpinner(new SpinnerNumberModel(0, 0, null, 1));
  frontLoadLargeTopicSizeField.setEnabled(false); // Not yet implemented: requires Topic changes if changed
  formPanel.add(frontLoadLargeTopicSizeField);
  formPanel.add(new JLabel("Front load: last period size"));
  frontLoadLastPeriodSizeField = new JSpinner(new SpinnerNumberModel(0, 0, null, 1));
  frontLoadLastPeriodSizeField.setEnabled(false); // Not yet implemented: requires Period changes if changed
  formPanel.add(frontLoadLastPeriodSizeField);
  formPanel.add(new JLabel("Front load: penalty"));
  frontLoadPenaltyField = new JSpinner(new SpinnerNumberModel(0, 0, null, 1));
  formPanel.add(frontLoadPenaltyField);
  return formPanel;
}

代码示例来源:origin: stackoverflow.com

tree.expandRow(ii);
JPanel buttonPanel = new JPanel(buttonLayout);
gui.add(buttonPanel, BorderLayout.PAGE_START);
buttonPanel.add(new JLabel("H Gap"));
final JSpinner hSpinner = 
    new JSpinner(new SpinnerNumberModel(0,0,15,1));
buttonPanel.add(new JLabel("V Gap"));
final JSpinner vSpinner = 
    new JSpinner(new SpinnerNumberModel(0,0,15,1));
buttonPanel.add(new JLabel("H Border"));
final JSpinner hBorderSpinner = 
    new JSpinner(new SpinnerNumberModel(0,0,15,1));
    new JSpinner(new SpinnerNumberModel(0,0,15,1));
  JFrame f = new JFrame("White (OK Red) Space");
  f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  f.setVisible(true);

代码示例来源:origin: stackoverflow.com

add(new JPanel() {{
setLayout(...);
setBorder(...);
add(new JLabel(...));
add(new JSpinner(...));
}});

代码示例来源:origin: org.openimaj/sandbox

private void createUI() {
  final JFrame frame = new JFrame("PDM Builder");
  final JPanel panel = new JPanel();
  frame.getContentPane().add(panel);
  ic = new DisplayUtilities.ImageComponent(true, false);
  ic.setAllowPanning(false);
  ic.setAllowZoom(false);
  ic.setImage(ImageUtilities.createBufferedImage(images.get(0)));
  ic.setPreferredSize(ic.getSize());
  ic.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      registerClick(e.getX(), e.getY());
    }
  });
  panel.add(ic);
  final SpinnerModel model = new SpinnerNumberModel(0, 0, images.size(), 1);
  imageSpinner = new JSpinner(model);
  new JSpinner.NumberEditor(imageSpinner);
  imageSpinner.addChangeListener(this);
  panel.add(imageSpinner);
  labelsList = new JComboBox<String>(pointLabels);
  labelsList.addActionListener(this);
  panel.add(labelsList);
  frame.pack();
  frame.setVisible(true);
}

代码示例来源:origin: stackoverflow.com

getContentPane().add(actionPanel,BorderLayout.NORTH);
getContentPane().add(demoPanel,BorderLayout.CENTER);
  setVisible(true);
setTitle("White Space");
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
  setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
  label1 = new JLabel("This is first line");
  label2 = new JLabel("This is second line");
  add(label1);
  if(withGlue){
    add(Box.createVerticalGlue());
  add(Box.createHorizontalStrut(10));
  JLabel strutLabel = new JLabel("Strut Value");
  add(strutLabel);
  spinner = new JSpinner(new SpinnerNumberModel(0,0,50,1));
  spinner.addChangeListener(new spinnerListener());
  add(spinner);

代码示例来源:origin: sc.fiji/VIB-lib

public static JSpinner addLabeledSpinner(Container c, String label,
    SpinnerModel model) {
  JLabel l = new JLabel(label);
  Box b = new Box(BoxLayout.X_AXIS);
  b.add(l);
  JSpinner spinner = new JSpinner(model);
  l.setLabelFor(spinner);
  b.add(spinner);
  c.add(b);
  return spinner;
}

代码示例来源:origin: magefree/mage

spnAmount = new javax.swing.JSpinner();
panelCommands = new javax.swing.JPanel();
btnOk = new javax.swing.JButton();
btnCancel = new javax.swing.JButton();
jScrollPane1.setViewportView(lblMessage);
spnAmount.setModel(new javax.swing.SpinnerNumberModel(1, null, null, 1));

代码示例来源:origin: dboissier/mongo4idea

private JPanel createTimePanel() {
  JPanel newPanel = new JPanel();
  newPanel.setLayout(new FlowLayout());
  SpinnerDateModel dateModel = new SpinnerDateModel();
  timeSpinner = new JSpinner(dateModel);
  if (timeFormat == null) timeFormat = DateFormat.getTimeInstance(DateFormat.SHORT);
  updateTextFieldFormat();
  newPanel.add(timeSpinner);
  return newPanel;
}

代码示例来源:origin: IanDarwin/javasrc

public static void main(String[] args) {
    JFrame jf = new JFrame("It Spins");
    Container cp = jf.getContentPane();
    cp.setLayout(new GridLayout(0,1));

    // Create a JSpinner using one of the pre-defined SpinnerModels
    JSpinner dates = new JSpinner(new SpinnerDateModel());
    cp.add(dates);

    // Create a JSPinner using a SpinnerListModel. 
    String[] data = { "One", "Two", "Three" };
    JSpinner js = new JSpinner(new SpinnerListModel(data));
    cp.add(js);

    jf.setSize(100, 80);
    jf.setVisible(true);
  }
}

代码示例来源:origin: winder/Universal-G-Code-Sender

public Spinner(String text, SpinnerModel model) {
  label = new JLabel(text);
  spinner = new JSpinner(model);
  setLayout(new MigLayout("insets 0, wrap 2"));
  add(spinner, "w 70");
  add(label);
}

代码示例来源:origin: stackoverflow.com

public class spinnerdemo {
  public void show() {
    JFrame f = new JFrame("JSpinner Demo");
    f.setSize(500, 100);
    f.setLayout(new GridLayout(1, 1));
    JSpinner ctrlSpin = new JSpinner();
    ctrlSpin.addChangeListener(new javax.swing.event.ChangeListener() {
      @Override
      public void stateChanged(javax.swing.event.ChangeEvent evt) {
        System.out.println("" + ctrlSpin.getValue());
      }
    });
    ctrlSpin.setModel(new SpinnerTimeModel());
    //set the DateEditor
    ctrlSpin.setEditor(new JSpinner.DateEditor(ctrlSpin, "dd/MM/yyyy HH:mm:ss.SS"));
    f.add(ctrlSpin);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
  }
  public static void main(String[] args) {
    new spinnerdemo().show();
  }
}

代码示例来源:origin: stackoverflow.com

import javax.swing.*;
import java.awt.event.*;
public class TestSpinner extends JFrame implements
MouseWheelListener
{
 public TestSpinner()
 {
  setSize( 100, 50 );
  spinner = new JSpinner();
  spinner.addMouseWheelListener( this );
  getContentPane().add( spinner, "Center" );
 }
 public void mouseWheelMoved( MouseWheelEvent e )
 {
  spinner.setValue( new Integer(
((Integer)spinner.getValue()).intValue() -
e.getWheelRotation() ) );
 }
 public static void main( String [] args )
 {
  TestSpinner t = new TestSpinner();
  t.setVisible( true );
 }
 private JSpinner spinner;
}

代码示例来源:origin: stackoverflow.com

private JSpinner gravitySpinner;
private JPanel mainPanel = new JPanel();
 mainPanel.add(draw, BorderLayout.CENTER);
 userInt = new JPanel();
 mainPanel.add(userInt, BorderLayout.NORTH);
 userInt.add(b1);
 userInt.add(b2);
 SpinnerNumberModel gravityModel = new SpinnerNumberModel(.9, .1, 2, .1);
 gravitySpinner = new JSpinner(gravityModel);
 userInt.add(gravitySpinner);
 SwingUtilities.invokeLater(new Runnable() {
   public void run() {
    JFrame window = new JFrame("Ball");
    window.add(new StartingPoint().getMainPanel());
    window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    window.setVisible(true);

代码示例来源:origin: kiegroup/optaplanner

private JPanel createTableHeader() {
  JPanel headerPanel = new JPanel(new FlowLayout());
  headerPanel.add(new JLabel("Standard deviation maximum"));
  standardDeviationMaximumField = new JSpinner(new SpinnerNumberModel(1.0, 0.0, 10.0, 0.001));
  standardDeviationMaximumField.setEditor(new JSpinner.NumberEditor(standardDeviationMaximumField,
      InvestmentNumericUtil.MILLIS_PERCENT_PATTERN));
  headerPanel.add(standardDeviationMaximumField);
  standardDeviationMaximumField.addChangeListener(new ChangeListener() {
    @Override
    public void stateChanged(ChangeEvent e) {
      if (ignoreChangeEvents) {
        return;
      }
      long standardDeviationMillisMaximum = (long) (((Number) standardDeviationMaximumField.getValue()).doubleValue() * 1000.0);
      changeStandardDeviationMillisMaximum(standardDeviationMillisMaximum);
    }
  });
  return headerPanel;
}

代码示例来源:origin: marytts/marytts

jLabel5 = new javax.swing.JLabel();
cbSpeakerBitsPerSample = new javax.swing.JComboBox();
jPanel_TimingOptions = new javax.swing.JPanel();
jLabel_BufferAdded = new javax.swing.JLabel();
jSpinner_BufferAdded = new javax.swing.JSpinner();
jLabel_PauseBufferAddedUnits = new javax.swing.JLabel();
jLabel_PauseBetweenrecUnits = new javax.swing.JLabel();
jSpinner_TimePerChar = new javax.swing.JSpinner();
jLabel_TimePerChar = new javax.swing.JLabel();
jLabel_PauseAfterSynth = new javax.swing.JLabel();
jSpinner_PauseAfterSynth = new javax.swing.JSpinner();
jLabel_PauseAfterSynthUnits = new javax.swing.JLabel();
jLabel_SilenceDuration = new javax.swing.JLabel();
jSpinner_SilenceDuration = new javax.swing.JSpinner();
jLabel_SilenceDurationBeforeRecUnits = new javax.swing.JLabel();
jPanel_DisplayOptions = new javax.swing.JPanel();
jCheckBox_SystemLookAndFeel = new javax.swing.JCheckBox();
jCheckBox_ShowTestOutput = new javax.swing.JCheckBox();

代码示例来源:origin: libgdx/libgdx

private void initializeComponents () {
    JPanel contentPanel = getContentPanel();
    {
      JLabel label = new JLabel("Value:");
      contentPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
        new Insets(0, 0, 0, 6), 0, 0));
    }
    {
      valueSpinner = new JSpinner(new SpinnerNumberModel(new Float(0), new Float(-99999), new Float(99999), new Float(0.1f)));
      contentPanel.add(valueSpinner, new GridBagConstraints(1, 1, 1, 1, 1, 0, GridBagConstraints.WEST,
        GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    }
  }
}

代码示例来源:origin: openimaj/openimaj

private void createUI() {
  final JFrame frame = new JFrame("PDM Builder");
  final JPanel panel = new JPanel();
  frame.getContentPane().add(panel);
  ic = new DisplayUtilities.ImageComponent(true, false);
  ic.setAllowPanning(false);
  ic.setAllowZoom(false);
  ic.setImage(ImageUtilities.createBufferedImage(images.get(0)));
  ic.setPreferredSize(ic.getSize());
  ic.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      registerClick(e.getX(), e.getY());
    }
  });
  panel.add(ic);
  final SpinnerModel model = new SpinnerNumberModel(0, 0, images.size(), 1);
  imageSpinner = new JSpinner(model);
  new JSpinner.NumberEditor(imageSpinner);
  imageSpinner.addChangeListener(this);
  panel.add(imageSpinner);
  labelsList = new JComboBox<String>(pointLabels);
  labelsList.addActionListener(this);
  panel.add(labelsList);
  frame.pack();
  frame.setVisible(true);
}

代码示例来源:origin: org.protege/protege-editor-owl

public void initialise() throws Exception {
  OWLTreePreferences prefs = OWLTreePreferences.getInstance();
  autoExpandEnabledCheckBox = new JCheckBox("Automatically expand hierarchies", prefs.isAutoExpandEnabled());
  autoExpandMaxDepthSpinner = new JSpinner(new SpinnerNumberModel(prefs.getAutoExpansionDepthLimit(), 1, Integer.MAX_VALUE, 1));
  autoExpandMaxChildSizeSpinner = new JSpinner(new SpinnerNumberModel(prefs.getAutoExpansionChildLimit(), 1, Integer.MAX_VALUE, 1));
  JPanel autoExpansionPanel = new JPanel();
  PreferencesPanelLayoutManager layout = new PreferencesPanelLayoutManager(autoExpansionPanel);
  autoExpansionPanel.setLayout(layout);
  autoExpansionPanel.add("", autoExpandEnabledCheckBox);
  autoExpansionPanel.add("Auto-expansion depth limit", autoExpandMaxDepthSpinner);
  autoExpansionPanel.add("Auto-expansion child count limit", autoExpandMaxChildSizeSpinner);
  autoExpansionPanel.setBorder(ComponentFactory.createTitledBorder("Automatic Hierarchy Expansion"));
  setLayout(new BorderLayout());
  add(autoExpansionPanel, BorderLayout.CENTER);
}

相关文章