e882. setting the order of the color chooser panel tabs in a jcolorchooser dialog.txt

来自「这里面包含了一百多个JAVA源文件」· 文本 代码 · 共 18 行

TXT
18
字号
The default order of chooser panels is: swatch chooser, HSB chooser, and RGB chooser. This example demonstrates how to change the ordering. 
    JColorChooser chooser = new JColorChooser();
    
    // Retrieve the number of panels
    int numPanels = chooser.getChooserPanels().length;
    
    // Create an array with the desired order of panels
    // findPanel() is defined in
    // e880 Retrieving the Color Chooser Panels in a JColorChooser Dialog.
    AbstractColorChooserPanel[] newPanels = new AbstractColorChooserPanel[numPanels];
    newPanels[0] = findPanel(chooser, "javax.swing.colorchooser.DefaultHSBChooserPanel");
    newPanels[1] = findPanel(chooser, "javax.swing.colorchooser.DefaultRGBChooserPanel");
    newPanels[2] = findPanel(chooser, "javax.swing.colorchooser.DefaultSwatchChooserPanel");
    
    // Set the new order of panels
    chooser.setChooserPanels(newPanels);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?