// Create a number spinner
    JSpinner spinner = new JSpinner();
    
    // Get the text field
    JFormattedTextField tf =
        ((JSpinner.DefaultEditor)spinner.getEditor()).getTextField();
    
    // Set the margin (add two spaces to the left and right side of the value)
    int top = 0;
    int left = 2;
    int bottom = 0;
    int right = 2;
    Insets insets = new Insets(top, left, bottom, right);
    tf.setMargin(insets);

 

Related Examples

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
  • 2021-10-27
  • 2021-06-17
  • 2021-08-29
猜你喜欢
  • 2021-11-21
  • 2022-12-23
  • 2021-10-19
  • 2022-02-17
  • 2021-07-30
相关资源
相似解决方案