1

Hi Can anybody help me to how to increase the size of jspinner arrows as per touch screen requirements on desktop

mKorbel
  • 109,525
  • 20
  • 134
  • 319

3 Answers3

2

change the size of JButton in spinner components like this:

        spn = new JSpinner();   
        spn.getComponent(0).setPreferredSize(new Dimension(40,40)); 

JSpinner has three component. two JButton and one JTextField.

  1. the 1st component is nextButton
  2. the 2nd component is previousButton
  3. the 3rd component is NumberEditor
Majid Hajibaba
  • 3,105
  • 6
  • 23
  • 55
1

help me to how to increase the size of jspinner arrows as per touch screen requirements on desktop

  • even is possible to change

    a) PreferredSize for Buttons (in API limited by Icons size 8x8, have to override too)

    b) relayout Buttons in JSpinner one on the LEFT (or SOUTH) and 2nd or RIGHT (or NORTH)

  • but for JSpinner I wouldn't going this way


  • create JTextField / JFormattedTextField with DocumentListener, implement there all limits to the DocumentFilter (by default for JSpinner is there the same requirements too)

  • put there two JButtons (by using JButton#setXxxIcon to set own Icon), for inc / des creasing value

  • for Date / Calendar use proper JCalendar or JDatePicker

Community
  • 1
  • 1
mKorbel
  • 109,525
  • 20
  • 134
  • 319
1

You might try one of these:

  • See if a large size variant is available for your chosen Look & Feel.

  • Change the Spinner.arrowButtonSize property using the UIManager.put() method.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • Please elaborate the second option. Property arrowButtonSize can't be found. – code_poetry Nov 20 '17 at 06:27
  • The key is `"Spinner.arrowButtonSize"`, for [example](http://nadeausoftware.com/articles/2008/11/all_ui_defaults_names_common_java_look_and_feels_windows_mac_os_x_and_linux), but not all L&Fs support it. – trashgod Nov 20 '17 at 19:47