Package org.jdesktop.wonderland.modules.avatarbase.client.imi.WonderlandCharacterParams

Examples of org.jdesktop.wonderland.modules.avatarbase.client.imi.WonderlandCharacterParams.ColorConfigElement


     * title.
     */
    private void configureColor(ConfigType type, String title) {
        // Fetch the current color given the configuration type. This assumes
        // it exists, otherwise, it's a bad error.
        ColorConfigElement config =
                (ColorConfigElement) currentParams.getElement(type);
        if (config == null) {
            LOGGER.info("Unable to find config element " + type);
            config = new HairColorConfigElement();
            config.setR(1.0f);
            config.setG(1.0f);
            config.setB(1.0f);
        }


        // Create the initial color, each color component is a floating point
        // value between 0.0 and 1.0, inclusive. Show the dialog.
        Color rgb = new Color(config.getR(), config.getG(), config.getB());
        Color hairColor = JColorChooser.showDialog(this, title, rgb);
        if (hairColor == null) {
            return;
        }

        // Take the new values from the dialog and set the configuration
        // element. We need to convert the integer values between 0 and 255 to
        // floating point values between 0.0 and 1.0.
        config.setR(hairColor.getRed() / 255.0f);
        config.setG(hairColor.getGreen() / 255.0f);
        config.setB(hairColor.getBlue() / 255.0f);
        currentParams.setElement(type, config);
        apply();
    }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.modules.avatarbase.client.imi.WonderlandCharacterParams.ColorConfigElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.