JColorChooser RGB选项卡与自定义文本

huangapple go评论85阅读模式
英文:

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.

JColorChooser RGB选项卡与自定义文本

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.buildChooserColorModel.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.

huangapple
  • 本文由 发表于 2023年8月8日 20:29:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76859580.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定