英文:
JColorChooser RGB Tab with custom text
问题
我正在通过修改UIManager的默认值来自定义JColorChooser的外观。我已成功自定义了标签和文本,除了Color Code。
我使用以下代码修改RGB选项卡的内容:
UIManager.put("ColorChooser.rgbRedText", "自定义红色:");
UIManager.put("ColorChooser.rgbGreenText", "自定义绿色:");
UIManager.put("ColorChooser.rgbBlueText", "自定义蓝色:");
UIManager.put("ColorChooser.rgbAlphaText", "自定义透明度:");
然而,当我尝试对Color Code进行相同的操作时,它不起作用:
UIManager.put("ColorChooser.rgbColorCodeText", "自定义颜色代码:");
我该如何访问UIManager以进行自定义?
英文:
I am customizing JColorChooser by modifying the UIManager's defaults for the JColorChooser tabs. I have successfully customized the labels and texts except the Color Code one.
I used the following code to modify the contents of the RGB tab.
UIManager.put("ColorChooser.rgbRedText", "Custom Red:");
UIManager.put("ColorChooser.rgbGreenText", "Custom Green:");
UIManager.put("ColorChooser.rgbBlueText", "Custom Blue:");
UIManager.put("ColorChooser.rgbAlphaText", "Custom Alpha:");
However, when I try the same thing for Color Code it doesn't work:
UIManager.put("ColorChooser.rgbColorCodeText", "Custom Color Code:");
How can I access UIManager to customize it?
答案1
得分: 4
颜色代码字段标签的关键是ColorChooser.rgbHexCodeText
,而不是ColorChooser.rgbColorCodeText
。
请参阅ColorChooserPanel.buildChooser和ColorModel.getText的源代码。
英文:
The key for the color code field label is not ColorChooser.rgbColorCodeText
but ColorChooser.rgbHexCodeText
.
See the ColorChooserPanel.buildChooser and ColorModel.getText source code.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论