Java Code Examples for javax.swing.plaf.basic.BasicSpinnerUI

The following examples show how to use javax.swing.plaf.basic.BasicSpinnerUI. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: java-swing-tips   Source File:    License: MIT License 5 votes vote down vote up
private MainPanel() {
  super(new BorderLayout());
  SpinnerModel model = new SpinnerNumberModel(10, 0, 1000, 1);

  Box box = Box.createVerticalBox();
  box.add(makeTitledPanel("Default", new JSpinner(model)));

  JSpinner spinner1 = new JSpinner(model);
  box.add(makeTitledPanel("RIGHT_TO_LEFT", spinner1));

  JSpinner spinner2 = new JSpinner(model) {
    @Override public void updateUI() {
      setUI(new BasicSpinnerUI() {
        @Override protected LayoutManager createLayout() {
          return new SpinnerLayout();
  box.add(makeTitledPanel("L(Prev), R(Next)", spinner2));

  JSpinner spinner3 = new JSpinner(model) {
    @Override public void setLayout(LayoutManager mgr) {
      super.setLayout(new SpinnerLayout());
  box.add(makeTitledPanel("L(Prev), R(Next)", spinner3));

  add(box, BorderLayout.NORTH);
  setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  setPreferredSize(new Dimension(320, 240));