⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e880. retrieving the color chooser panels in a jcolorchooser dialog.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
There are three chooser panels in the default JColorChooser dialog. Although each is implemented by a class in the javax.swing.colorchooser package, these classes are not public. This example demonstrates how to identify these panels by class name. 
    JColorChooser chooser = new JColorChooser();
    
    // Retrieve the swatch chooser
    findPanel(chooser, "javax.swing.colorchooser.DefaultSwatchChooserPanel");
    
    // Retrieve the HSB chooser
    findPanel(chooser, "javax.swing.colorchooser.DefaultHSBChooserPanel");
    
    // Retrieve the RGB chooser
    findPanel(chooser, "javax.swing.colorchooser.DefaultRGBChooserPanel");
    
    // Returns the panel instance with the specified name.
    // Returns null if not found.
    public AbstractColorChooserPanel findPanel(JColorChooser chooser, String name) {
        AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    
        for (int i=0; i<panels.length; i++) {
            String clsName = panels[i].getClass().getName();
    
            if (clsName.equals(name)) {
                return panels[i];
            }
        }
        return null;
    }


⌨️ 快捷键说明

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