Java Code Examples for org.controlsfx.glyphfont.GlyphFontRegistry#font()

The following examples show how to use org.controlsfx.glyphfont.GlyphFontRegistry#font() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QuestProgress.java    From logbook-kai with MIT License 6 votes vote down vote up
private static void setConditionIcon(TreeItem<String> item, Boolean result) {
    GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");

    StackPane pane = new StackPane();
    pane.setPrefWidth(18);

    if (result != null) {
        if (result) {
            pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.CHECK).color(Color.GREEN));
        } else {
            pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.EXCLAMATION).color(Color.RED));
        }
    } else {
        pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.QUESTION).color(Color.GRAY));
    }
    item.setGraphic(pane);
}
 
Example 2
Source File: MissionCheck.java    From logbook-kai with MIT License 6 votes vote down vote up
private void setIcon(TreeItem<String> item, Boolean result) {
    GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");

    StackPane pane = new StackPane();
    pane.setPrefWidth(18);

    if (result != null) {
        if (result) {
            pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.CHECK).color(Color.GREEN));
        } else {
            pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.EXCLAMATION).color(Color.RED));
        }
    } else {
        pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.QUESTION).color(Color.GRAY));
    }
    item.setGraphic(pane);
}
 
Example 3
Source File: NavigationView.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes the TextField and sets the search icon.
 */
private void setupTextField() {
  searchFld = new CustomTextField();
  GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");
  Glyph glyph = fontAwesome.create(FontAwesome.Glyph.SEARCH).color(Color.GRAY);
  glyph.setPadding(new Insets(0, 3, 0, 5));
  searchFld.setLeft(glyph);
}
 
Example 4
Source File: QuestProgress.java    From logbook-kai with MIT License 5 votes vote down vote up
private static void setFilterIcon(TreeItem<String> item) {
    GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");
    StackPane pane = new StackPane();
    pane.setPrefWidth(18);
    pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.FILTER).color(Color.ROYALBLUE));
    item.setGraphic(pane);
}
 
Example 5
Source File: QuestProgress.java    From logbook-kai with MIT License 5 votes vote down vote up
private static void setFilterListIcon(TreeItem<String> item) {
    GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");
    StackPane pane = new StackPane();
    pane.setPrefWidth(18);
    pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.ANGLE_RIGHT).color(Color.ROYALBLUE));
    item.setGraphic(pane);
}
 
Example 6
Source File: MissionCheck.java    From logbook-kai with MIT License 5 votes vote down vote up
private TreeItem<String> buildTree0(Mission mission, List<Ship> fleet) {
    try {
        TreeItem<String> item;
        Optional<MissionCondition> condition = Missions.getMissionCondition(mission.getId());
        if (condition.isPresent()) {
            MissionCondition cond = condition.get();
            cond.test(fleet);
            item = this.buildLeaf(cond);
        } else if (mission.getSampleFleet() != null) {
            item = new TreeItem<>();
            setIcon(item, null);
        } else {
            return null;
        }
        item.setValue(mission.toString());
        if (mission.getSampleFleet() != null) {
            TreeItem<String> sample = new TreeItem<>("サンプル編成");

            GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");

            StackPane pane = new StackPane();
            pane.setPrefWidth(18);
            pane.getChildren().add(fontAwesome.create(FontAwesome.Glyph.INFO));
            sample.setGraphic(pane);

            for (Integer type : mission.getSampleFleet()) {
                Optional.ofNullable(StypeCollection.get()
                        .getStypeMap()
                        .get(type))
                        .map(Stype::getName)
                        .ifPresent(name -> sample.getChildren().add(new TreeItem<>(name)));
            }
            item.getChildren().add(sample);
        }
        return item;
    } catch (Exception e) {
        LoggerHolder.get().error("遠征確認画面で例外", e);
    }
    return null;
}
 
Example 7
Source File: IconUtils.java    From PeerWasp with MIT License 5 votes vote down vote up
/**
 * Returns an error icon (glyph created using font awesome).
 *
 * @return graphic node
 */
public static Node createErrorIcon() {
	GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");
	Glyph graphic = fontAwesome.create(FontAwesome.Glyph.EXCLAMATION_TRIANGLE);
	graphic.setFontSize(20.0);
	graphic.setColor(Color.RED);
	return graphic;
}
 
Example 8
Source File: IconUtilsTest.java    From PeerWasp with MIT License 5 votes vote down vote up
@Test
public void testInitFontAwesomeOffline() {
	// this test may fail if already initialized due to other tests.
	assertNull(IconUtils.getFontAwesome());

	IconUtils.initFontAwesomeOffline();
	GlyphFont font = IconUtils.getFontAwesome();
	assertNotNull(font);

	GlyphFont registeredFont = GlyphFontRegistry.font("FontAwesome");
	assertNotNull(registeredFont);
	assertEquals(font, registeredFont);
}