Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright (c) 2013, 2015 ControlsFX
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of ControlsFX, any associated website, nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.controlsfx.glyphfont;
import java.util.Optional;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.paint.*;
import javafx.scene.text.Font;
import org.controlsfx.control.action.Action;
import org.controlsfx.tools.Duplicatable;
/**
* Represents one glyph from the font.
* The glyph is actually a label showing one character from the specified font. It can be used as 'graphic' on any UI
* control or {@link Action}. It can also directly be used in FXML.
*
* Examples:
*
*
{@code
* new Button("", new Glyph("FontAwesome", "BEER"))
* }
*
*
{@code
* new Button("", new Glyph("FontAwesome", FontAwesome.Glyph.BEER))
* }
*
* Thy Glyph-Class also offers a fluent API to customize the look of the Glyph.
* For example, you can set the color {@link #color(javafx.scene.paint.Color)} or
* also add effects such as {@link #useHoverEffect()}
*
*
An ability to retrieve glyph node by combination of font name and glyph name
* extends to the {@link org.controlsfx.control.action.ActionProxy} graphic attribute, where the "font>"
* prefix should be used. For more information see {@link org.controlsfx.control.action.ActionProxy}.
*
*/
public class Glyph extends Label implements Duplicatable {
/***************************************************************************
* *
* Static creators *
* *
**************************************************************************/
/**
* Retrieve glyph by font name and glyph name using one string
* where font name an glyph name are separated by pipe.
*
* @param fontAndGlyph The font and glyph separated by a pipe. Example: "FontAwesome|STAR"
* @return A instance of a Glyph node
*/
public static Glyph create(String fontAndGlyph) {
String[] args = fontAndGlyph.split("\\|"); //$NON-NLS-1$
return new Glyph(args[0], args[1]);
}
/***************************************************************************
* *
* Private fields *
* *
**************************************************************************/
public final static String DEFAULT_CSS_CLASS = "glyph-font"; //$NON-NLS-1$
public final static String STYLE_GRADIENT = "gradient"; //$NON-NLS-1$
public final static String STYLE_HOVER_EFFECT = "hover-effect"; //$NON-NLS-1$
private final ObjectProperty