本文整理汇总了Java中de.jensd.fx.glyphs.GlyphIcons类的典型用法代码示例。如果您正苦于以下问题:Java GlyphIcons类的具体用法?Java GlyphIcons怎么用?Java GlyphIcons使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GlyphIcons类属于de.jensd.fx.glyphs包,在下文中一共展示了GlyphIcons类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setForegroundIcon
import de.jensd.fx.glyphs.GlyphIcons; //导入依赖的package包/类
/**
* Changes the foregroundIcon icon.
*
* Note: previous color setup and animations are reset as well.
*
* @param icon the icon which should be set as the new icon.
* @param color the color of the new icon.
*/
public void setForegroundIcon(final GlyphIcons icon, final Color color) {
// copy old images to replace later.
final Text oldForegroundIcon = foregroundIcon;
final Text oldForegroundFadeIcon = foregroundFadeIcon;
// create new images.
this.foregroundIcon = createIcon(icon, Layer.FOREGROUND);
this.foregroundFadeIcon = createColorFadeIcon(icon, Layer.FOREGROUND);
// setup icon color
if (color != null) {
setForegroundIconColor(color);
}
// replace old icons with new ones.
getChildren().replaceAll((node) -> {
if (node.equals(oldForegroundIcon)) {
return foregroundIcon;
} else if (node.equals(oldForegroundFadeIcon)) {
return foregroundFadeIcon;
} else {
return node;
}
});
}
示例2: addChildren
import de.jensd.fx.glyphs.GlyphIcons; //导入依赖的package包/类
private void addChildren() {
viewSwitcherPopUp.getChildren().clear();
for (Map.Entry<GlyphIcons, EventHandler<ActionEvent>> glyphIconsEventHandlerEntry : eventHandler.entrySet()) {
GlyphIcons icon = glyphIconsEventHandlerEntry.getKey();
EventHandler<ActionEvent> handler = glyphIconsEventHandlerEntry.getValue();
if (icon != parent) {
FloatingButton element = new FloatingButton(new SVGIcon(icon, Constants.SMALL_ICON, true));
viewSwitcherPopUp.getChildren().addAll(element);
element.setOnAction(event -> {
clickOnChild(icon);
if (Objects.nonNull(handler)) {
handler.handle(event);
}
});
}
}
}
示例3: createIconLabel
import de.jensd.fx.glyphs.GlyphIcons; //导入依赖的package包/类
public static Label createIconLabel(GlyphIcons icon, String iconSize, String text, ContentDisplay contentDisplay, Paint colour, String style)
{
Text iconLabel = GlyphsDude.createIcon(icon, iconSize);
iconLabel.setFill(colour);
Label label = new Label(text);
label.setTextFill(colour);
label.setStyle(style);
label.setGraphic(iconLabel);
label.setContentDisplay(contentDisplay);
return label;
}
示例4: getIconAsNode
import de.jensd.fx.glyphs.GlyphIcons; //导入依赖的package包/类
/**
*
* @param glyphsFactory
* @param fontIcon
* @return
*/
public Node getIconAsNode(GlyphsFactory glyphsFactory, GlyphIcons fontIcon) {
if (fontIcon == null) {
throw new IllegalArgumentException("'fontIcon' can't be NULL."); // NOI18N
}
// TODO add more data (size, color...)
final Node node = glyphsFactory.createIcon(fontIcon, "16px");// 1em
return node;
}
示例5: resolve
import de.jensd.fx.glyphs.GlyphIcons; //导入依赖的package包/类
@Override
public GlyphIcons resolve(final String fontIconName) {
final ObservableList<GlyphIcons> glyphIcons = FXCollections.observableArrayList();
glyphIcons.addAll(MaterialDesignIcon.values());
final Optional<GlyphIcons> oGlyphIcons = glyphIcons
.stream()
.filter((gi) -> gi.name().equals(fontIconName) )
.findFirst();
if (oGlyphIcons.isPresent()) {
return oGlyphIcons.get();
}
return null;
}
示例6: testGlyphIconsIsFound
import de.jensd.fx.glyphs.GlyphIcons; //导入依赖的package包/类
@Test
public void testGlyphIconsIsFound() {
final String fontIconName = "ACCOUNT_ALERT";
final GlyphIcons actualGlyphIcons = handler.resolve(fontIconName);
assertNotNull("actualGlyphIcons can't be NULL", actualGlyphIcons);
final GlyphIcons expectedGlyphIcons = MaterialDesignIcon.ACCOUNT_ALERT;
assertEquals("actualGlyphIcons.ACCOUNT_ALERT must be MaterialDesignIcon.ACCOUNT_ALERT", expectedGlyphIcons, actualGlyphIcons);
}
示例7: testGlyphIconsNOTFound
import de.jensd.fx.glyphs.GlyphIcons; //导入依赖的package包/类
@Test
public void testGlyphIconsNOTFound() {
final String fontIconName = "DONT_EXISTS";
final GlyphIcons actualGlyphIcons = handler.resolve(fontIconName);
assertNull("GlyphIcons.DONT_EXISTS can't exists", actualGlyphIcons);
}
示例8: getIcon
import de.jensd.fx.glyphs.GlyphIcons; //导入依赖的package包/类
public static GlyphIcons getIcon(Attribute attribute) {
GlyphIcons iconName = attributeMap.get(attribute);
if (iconName == null) {
iconName = SQUARE_INC;
}
return iconName;
}
示例9: Action
import de.jensd.fx.glyphs.GlyphIcons; //导入依赖的package包/类
public Action(String text, String accelerator, GlyphIcons icon,
EventHandler<ActionEvent> action, ObservableBooleanValue disable,
BooleanProperty selected)
{
this.text = text;
this.accelerator = (accelerator != null) ? KeyCombination.valueOf(accelerator) : null;
this.icon = icon;
this.action = action;
this.disable = disable;
this.selected = selected;
}
示例10: SVGIcon
import de.jensd.fx.glyphs.GlyphIcons; //导入依赖的package包/类
/**
* Constructor for a SVGIcon.
*
* @param icon the Icon to be set in the backgroundIcon
* (can be chosen from one of the supported fonts from fontawesomefx)
* @param size the size in px for the icon
* @param styled true if color should be changed by theme, otherwise false
*/
public SVGIcon(final GlyphIcons icon, final double size, final boolean styled) {
this(size, styled);
this.foregroundIcon = createIcon(icon, Layer.FOREGROUND);
this.foregroundFadeIcon = createColorFadeIcon(icon, Layer.FOREGROUND);
this.backgroundIcon = null;
this.backgroundFadeIcon = null;
this.getChildren().addAll(foregroundIcon, foregroundFadeIcon);
}
示例11: createIcon
import de.jensd.fx.glyphs.GlyphIcons; //导入依赖的package包/类
private static Text createIcon(final GlyphIcons glyphIcon, final double size, final boolean styled) {
final Text icon = GlyphsDude.createIcon(glyphIcon, String.valueOf(size));
icon.setSmooth(true);
if (styled) {
icon.getStyleClass().clear();
icon.getStyleClass().add(Constants.ICONS_CSS_STRING);
}
return icon;
}
示例12: createColorFadeIcon
import de.jensd.fx.glyphs.GlyphIcons; //导入依赖的package包/类
private static Text createColorFadeIcon(final GlyphIcons glyphIcon, final double size, final Layer layer) {
final Text icon = createIcon(glyphIcon, size, layer == Layer.FOREGROUND);
// should be only visible on fade.
icon.setOpacity(Constants.FULLY_TRANSPARENT);
return icon;
}
示例13: setBackgroundIcon
import de.jensd.fx.glyphs.GlyphIcons; //导入依赖的package包/类
/**
* Changes the backgroundIcon icon.
*
* Note: previous color setup and animations are reset as well.
*
* @param icon the icon which should be set as the new icon.
* @param color the color of the new icon.
*/
public void setBackgroundIcon(final GlyphIcons icon, final Color color) {
// copy old images to replace later.
final Text oldBackgroundIcon = backgroundIcon;
final Text oldBackgroundFadeIcon = backgroundFadeIcon;
// create new images.
this.backgroundIcon = createIcon(icon, Layer.BACKGROUND);
this.backgroundFadeIcon = createColorFadeIcon(icon, Layer.BACKGROUND);
// setup icon color
if (color != null) {
setBackgroundIconColor(color);
}
// add background icon if not exists
if (oldBackgroundIcon == null || oldBackgroundFadeIcon == null) {
getChildren().clear();
getChildren().addAll(this.backgroundIcon, this.backgroundFadeIcon, this.foregroundIcon, this.foregroundFadeIcon);
return;
}
// replace old icons with new ones.
getChildren().replaceAll((node) -> {
if (node.equals(oldBackgroundIcon)) {
return backgroundIcon;
} else if (node.equals(oldBackgroundFadeIcon)) {
return backgroundFadeIcon;
} else {
return node;
}
});
}
示例14: addParentElement
import de.jensd.fx.glyphs.GlyphIcons; //导入依赖的package包/类
public final void addParentElement(final GlyphIcons icon, final EventHandler<ActionEvent> value) {
parent = icon;
eventHandler.put(icon, value);
showParent();
addChildren();
setViewSwitchingButtonsVisible(visible);
}
示例15: clickOnChild
import de.jensd.fx.glyphs.GlyphIcons; //导入依赖的package包/类
public void clickOnChild(final GlyphIcons clicked) {
parent = clicked;
showParent();
addChildren();
switchingButtonsVisible();
}