Example usage for java.awt Color getRGB

List of usage examples for java.awt Color getRGB

Introduction

In this page you can find the example usage for java.awt Color getRGB.

Prototype

public int getRGB() 

Source Link

Document

Returns the RGB value representing the color in the default sRGB ColorModel .

Usage

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Present the user with a font selection dialog and update the widgets if
 * the user chooses a font./*from  w ww  . ja v a  2s . c  o  m*/
 */
private void configureFont() {
    FontChooser chooser;
    Font newFont;
    Color newColor;

    chooser = new FontChooser(this);
    chooser.setFont(getFontFromProperties());
    chooser.setColor(getColorFromProperties());

    LOGGER.debug("Font before choices: " + chooser.getNewFont());

    chooser.setVisible(true);

    newFont = chooser.getNewFont();
    newColor = chooser.getNewColor();

    // Values will be null if user canceled request
    if (newFont != null && newColor != null) {
        properties.setProperty(ConfigurationProperty.FONT_NAME.key(), newFont.getName());
        properties.setProperty(ConfigurationProperty.FONT_SIZE.key(), newFont.getSize() + "");
        properties.setProperty(ConfigurationProperty.FONT_STYLE.key(), newFont.getStyle() + "");

        properties.setProperty(ConfigurationProperty.FONT_COLOR.key(), newColor.getRGB() + "");

        LOGGER.debug("Font after choices: " + newFont);
        setFont(newFont, newColor);
    }
}