Example usage for javax.swing.plaf ColorUIResource ColorUIResource

List of usage examples for javax.swing.plaf ColorUIResource ColorUIResource

Introduction

In this page you can find the example usage for javax.swing.plaf ColorUIResource ColorUIResource.

Prototype

public ColorUIResource(float r, float g, float b) 

Source Link

Document

Constructs a ColorUIResource .

Usage

From source file:MyLookAndFeel.java

protected void initSystemColorDefaults(UIDefaults table) {
    super.initSystemColorDefaults(table);
    table.put("info", new ColorUIResource(255, 255, 225));
}

From source file:org.ut.biolab.medsavant.MedSavantClient.java

private static void setLAF() {
    try {//from   w w w  .  j  a v a2s. c  o  m

        if (ClientMiscUtils.MAC) {
            customizeForMac();
        }

        // UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); //Metal works with sliders.
        //UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); //GTK doesn't work with sliders.
        //UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); //Nimbus doesn't work with sliders.
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            LOG.debug("Installed LAF: " + info.getName() + " class: " + info.getClassName());
        }
        LOG.debug("System LAF is: " + UIManager.getSystemLookAndFeelClassName());
        LOG.debug("Cross platform LAF is: " + UIManager.getCrossPlatformLookAndFeelClassName());

        LookAndFeelFactory.addUIDefaultsInitializer(new LookAndFeelFactory.UIDefaultsInitializer() {
            public void initialize(UIDefaults defaults) {
                Map<String, Object> defaultValues = new HashMap<String, Object>();
                defaultValues.put("Slider.trackWidth", new Integer(7));
                defaultValues.put("Slider.majorTickLength", new Integer(6));
                defaultValues.put("Slider.highlight", new ColorUIResource(255, 255, 255));
                defaultValues.put("Slider.horizontalThumbIcon",
                        javax.swing.plaf.metal.MetalIconFactory.getHorizontalSliderThumbIcon());
                defaultValues.put("Slider.verticalThumbIcon",
                        javax.swing.plaf.metal.MetalIconFactory.getVerticalSliderThumbIcon());
                defaultValues.put("Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0));

                for (Map.Entry<String, Object> e : defaultValues.entrySet()) {
                    if (defaults.get(e.getKey()) == null) {
                        LOG.debug("Missing key " + e.getKey() + ", using default value " + e.getValue());
                        defaults.put(e.getKey(), e.getValue());
                    } else {
                        LOG.debug("Found key " + e.getKey() + " with value " + defaults.get(e.getKey()));
                    }
                }
            }
        });

        if (MiscUtils.WINDOWS) {
            UIManager.put("CheckBox.background", new javax.swing.plaf.ColorUIResource(Color.WHITE));
            UIManager.put("Panel.background", new javax.swing.plaf.ColorUIResource(Color.WHITE));
            LookAndFeelFactory.installJideExtension(LookAndFeelFactory.XERTO_STYLE_WITHOUT_MENU);
            /*UIManager.put("JideTabbedPane.tabAreaBackground", new javax.swing.plaf.ColorUIResource(Color.WHITE));
            UIManager.put("JideTabbedPane.background", new javax.swing.plaf.ColorUIResource(Color.WHITE));
            UIManager.put("SidePane.background", new javax.swing.plaf.ColorUIResource(Color.WHITE));*/
        } else {
            LookAndFeelFactory.installJideExtension();
        }

        LookAndFeelFactory.installDefaultLookAndFeelAndExtension();

        System.setProperty("awt.useSystemAAFontSettings", "on");
        System.setProperty("swing.aatext", "true");

        UIManager.put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0));

        //tooltips
        UIManager.put("ToolTip.background", new ColorUIResource(255, 255, 255));
        ToolTipManager.sharedInstance().setDismissDelay(8000);
        ToolTipManager.sharedInstance().setInitialDelay(500);
    } catch (Exception x) {
        LOG.error("Unable to install look & feel.", x);
    }

}