Localizing a JColorChooser

With the UIManager class, you have control over the text labels that appear in a default colorchooser. Look at following example. Note that you cannot change the text “Sample Text” of the default preview label (instead, you can create your own with setPreviewPane).


import javax.swing.event.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class Main extends JFrame {
   public Main() {
      super("JColorChooser Demonstration");
      UIManager.put("ColorChooser.swatchesNameText", "My Swatches"); 
      UIManager.put("ColorChooser.swatchesRecentText", "My Recent"); 
      UIManager.put("ColorChooser.hsbNameText", "My HSB"); 
      UIManager.put("ColorChooser.rgbNameText", "My RGB"); 
      UIManager.put("ColorChooser.previewText", "My Preview"); 
      UIManager.put("ColorChooser.rgbRedText", "My Red"); 
      UIManager.put("ColorChooser.rgbGreenText", "My Green"); 
      UIManager.put("ColorChooser.rgbBlueText", "My Blue"); 
      getContentPane().setLayout(new FlowLayout()); 
      final JColorChooser colorChooser = new JColorChooser(); 
      addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
   public static void main(String[] args) {
      Main main = new Main();