这些摇摆颜色的名字是什么意思

Sha*_*jun 1 java swing uimanager jradiobutton

一些名称很清楚,如背景,前景,焦点等.但有些只是混乱,如光,高光,阴影,黑暗等.我注意到这些一直用于摇摆UI,所以我推断这些是java的一部分行话.有没有人知道是否有文件可以解释这些名称?

RadioButton.background  
RadioButton.darkShadow  
RadioButton.disabledText    
RadioButton.focus           
RadioButton.foreground  
RadioButton.highlight   
RadioButton.light           
RadioButton.select          
RadioButton.shadow          
Run Code Online (Sandbox Code Playgroud)

ten*_*ica 5

这些是UIResource与之相关的元素JRadionButton.每个都Look & Feel提供不同的单选按钮外观,并可以为这些元素设置不同的默认值.L&F实现也可以使用这些密钥.

例如,这是一个方法javax.swing.plaf.basic.BasicBorders,使用RadioButton.lightRadioButton.highlight:

public static Border getRadioButtonBorder() {
UIDefaults table = UIManager.getLookAndFeelDefaults();
Border radioButtonBorder = new BorderUIResource.CompoundBorderUIResource(
           new BasicBorders.RadioButtonBorder(
                   table.getColor("RadioButton.shadow"),
                                       table.getColor("RadioButton.darkShadow"),
                                       table.getColor("RadioButton.light"),
                                       table.getColor("RadioButton.highlight")),
                     new MarginBorder());
return radioButtonBorder;
}
Run Code Online (Sandbox Code Playgroud)

但是,具体的L&F实施可能不会使用它.

PS: UIManager默认由@camickr可以方便地显示不同的键.