一个困扰很久的问题:如何设置JSpinner控件不可用(即setEnabled(false))时的字体颜色?倾囊相送!非常感谢!我知道如何设置JTextField、JComboBox、JTextArea、JLabel、JCheckBox和JRadioButton控件不可用时的字体颜色,我的方法如下,大家给点意见:    UIManager.put("TextField.inactiveForeground", Color.black);
    UIManager.put("Label.disabledForground", Color.black);
    UIManager.put("ComboBox.disabledForeground", Color.black);
    UIManager.put("TextArea.inactiveForeground", Color.black);
    UIManager.put("CheckBox.disabledText", Color.darkGray);
    UIManager.put("RadioButton.disabledText", Color.darkGray);
    UIManager.put("Spinner.foreground", Color.black);但是对于JSpinner,我一直没有找到对应的处理办法,试了Spinner的好多字段,都不行,希望高手指点迷津!非常感谢!也希望大家都来参与,参与有份的!有没有解决的办法呀?有办法就可以,不求办法很好,有就行!非常感谢!

解决方案 »

  1.   

    将所有有格式的编辑框变色,就在实例化前调用 UIManager.put("FormattedTextField.inactiveForeground", javax.swing.plaf.ColorUIResource.RED);单独设置某一个JSpinner的颜色:((JSpinner.DefaultEditor)jSpinner1.getEditor()).getTextField().setDisabledTextColor(Color.RED);
      

  2.   

    非常感谢Jeansken(),关键Key我找了很长时间没找到,非常感谢
    请回答这个帖子,把分数都给你!
    http://community.csdn.net/Expert/topic/5186/5186744.xml?temp=.3240778