e790. 设置JSpinner的边框

 // 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
posted @ 2018-09-06 09:09  borter  阅读(111)  评论(0编辑  收藏  举报