org.eclipse.fx.ui.controls.image.FontIconStyleConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.eclipse.fx.ui.controls Show documentation
Show all versions of org.eclipse.fx.ui.controls Show documentation
Custom JavaFX controls like a styled text component, ...
The newest version!
/*******************************************************************************
* Copyright (c) 2014 BestSolution.at and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Christoph Caks - initial API and implementation
*******************************************************************************/
package org.eclipse.fx.ui.controls.image;
import javafx.css.ParsedValue;
import javafx.css.StyleConverter;
import javafx.scene.text.Font;
//import com.sun.javafx.Utils;
/**
* Convert the string into an icon
*/
@SuppressWarnings("restriction")
public class FontIconStyleConverter extends StyleConverter {
@Override
public FontIcon convert(ParsedValue value, Font font) {
String v = value.getValue();
// v = Utils.convertUnicode(v);
if (v.length() == 1) {
char c = v.charAt(0);
return FontIcon.create(c);
}
else {
return FontIcon.create(v);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy