javafx - FontAwesomeFX - only rectangles displayed -
i'm trying use fontawesomefx 8.4 in javafx app, every glyph displayed rectangle (the "missing character" glyph). way, how test app author looks like:
any ideas wrong?
i'm on arch linux , using intellij idea.
pom:
<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>de.jensd.fx.glyphs</groupid> <artifactid>testapps</artifactid> <version>1.0-snapshot</version> <dependencies> <dependency> <groupid>de.jensd</groupid> <artifactid>fontawesomefx</artifactid> <version>8.4</version> </dependency> </dependencies>
this step step guide using intellij idea maven using fontawesomefx demo app. have windows 8.1 x64 installation, should work on every os. maybe other people give try , add comment.
step 1
create new project of type maven. select sdk if none jdk set. not select archetype or not check "create archetype" box. click next.
step 2
give group-id "com.mycompany" , give artifact-id "fademo" version not relevant. click next.
step3
give project name , location store files. click next.
step4
this how new project looks like. move on next step.
step5
now copy dependency pom.xml. afer have saved file, there display shown in right upper corner wanted update maven.
simply click "enable auto-import". move on next step.
step6
now create new java class "app" , copy , paste content of app source in. after that, save new class.
now able start whole fontawesomefx demo app right clicking app.java file , choosing "run app.main()".
step7
this how demo app looking.

source code
dependency pom.xml
<dependencies> <dependency> <groupid>de.jensd</groupid> <artifactid>fontawesomefx</artifactid> <version>8.4</version> </dependency> </dependencies> app.java
import de.jensd.fx.glyphs.glyphsbuilder; import de.jensd.fx.glyphs.glyphsdude; import de.jensd.fx.glyphs.glyphsstack; import de.jensd.fx.glyphs.glyphsstyle; import de.jensd.fx.glyphs.fontawesome.fontawesomeicon; import de.jensd.fx.glyphs.fontawesome.fontawesomeiconview; import de.jensd.fx.glyphs.weathericons.weathericon; import de.jensd.fx.glyphs.weathericons.weathericonview; import javafx.application.application; import javafx.geometry.insets; import javafx.geometry.pos; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.control.contentdisplay; import javafx.scene.control.menu; import javafx.scene.control.menubar; import javafx.scene.control.menuitem; import javafx.scene.control.separatormenuitem; import javafx.scene.control.togglebutton; import javafx.scene.layout.hbox; import javafx.scene.layout.region; import javafx.scene.layout.vbox; import javafx.scene.text.text; import javafx.stage.stage; /** * @author jens deters */ public class app extends application { @override public void start(stage primarystage) throws exception { vbox root = new vbox(); root.setspacing(10.0); button testbutton = new button(); testbutton.getstyleclass().setall("exit-button"); glyphsdude.seticon(testbutton, fontawesomeicon.power_off, "6em"); button testbutton2 = new button(); testbutton2.getstyleclass().add("alien-button"); glyphsdude.seticon(testbutton2, weathericon.alien, "6em"); fontawesomeiconview fontawesomeicon = new fontawesomeiconview(fontawesomeicon.ambulance); fontawesomeicon.setstyleclass("blue-icon"); fontawesomeicon.setsize("4em"); weathericonview weathericon1 = new weathericonview(weathericon.cloud); weathericon1.setstyleclass("blue-icon"); weathericon1.setsize("4em"); /* * .thumbs-up-icon{ * -glyph-name: "thumbs_up"; * -glyph-size: 6em; * } * * .thumbs-down-icon{ * -glyph-name: "thumbs_down"; * -glyph-size: 6em; * } */ fontawesomeiconview thumbsupicon = new fontawesomeiconview(); thumbsupicon.setstyleclass("thumbs-up-icon"); fontawesomeiconview thumbsdownicon = new fontawesomeiconview(); thumbsdownicon.setstyleclass("thumbs-down-icon"); weathericonview weathericon2 = new weathericonview(); weathericon2.setstyleclass("green-icon"); weathericon2.setsize("4em"); text githublabel = glyphsdude.createicon(fontawesomeicon.github); text ambulancelabel = glyphsdude.createicon(fontawesomeicon.plus_square_alt, "60.0"); button starbutton = glyphsdude.createiconbutton(fontawesomeicon.star, "nice!", "48.0", "20.0", contentdisplay.top); button cloudbutton = glyphsdude.createiconbutton(fontawesomeicon.cloud, "download"); togglebutton togglebutton = glyphsdude.createicontogglebutton(fontawesomeicon.lock, "lock", "60.0", contentdisplay.top); region stackedicon1 = glyphsstack.create().add(glyphsbuilder.create(fontawesomeiconview.class).glyph(fontawesomeicon.ambulance).build()); region stackedicon2 = glyphsstack.create() .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.square) .size("3em") .styleclass("stack-base") .build() ) .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.star) .size("2em") .styleclass("stack-top") .build() ); region stackedicon3 = glyphsstack.create() .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.square) .style("-fx-font-size: 4em; -fx-fill: yellowgreen;") .build() ) .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.apple) .style("-fx-font-size: 3em; -fx-fill: white;") .build() ); region stackedicon4 = glyphsstack.create() .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.square) .style("-fx-font-size: 4em; -fx-fill: yellowgreen;") .build() ) .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.apple) .style("-fx-font-size: 3em; -fx-fill: black;") .build() ); region stackedicon5 = glyphsstack.create() .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.bug) .style("-fx-font-size: 2em; -fx-fill: black;") .build() ) .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.ban) .style("-fx-font-size: 6em; -fx-fill: red; -fx-opacity: 0.5;") .build() ); region stackedicon6 = glyphsstack.create() .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.circle) .style("-fx-font-size: 10em; -fx-fill: linear-gradient(#70b4e5 0%, #247cbc 70%, #2c85c1 85%);") .build() ) .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.twitter) .style("-fx-font-size: 6em; -fx-fill: white;") .build() ); region stackedicon7 = glyphsstack.create() .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.circle) .style("-fx-font-size: 10em; -fx-fill: linear-gradient(#70b4e5 0%, #247cbc 70%, #2c85c1 85%);") .build() ) .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.bitbucket) .style("-fx-font-size: 6em; " + "-fx-fill: linear-gradient(#ffffff, #d2d2d2); " + "-fx-effect: dropshadow( one-pass-box , rgba(0,0,0,0.8) , 4 , 0.0 , 1 , 1 );") .build() ); hbox stackiconbox1 = new hbox(); stackiconbox1.setspacing(5.0); stackiconbox1.setpadding(new insets(10.0)); stackiconbox1.getchildren().addall(stackedicon1, stackedicon2, stackedicon3, stackedicon4, stackedicon5, stackedicon6, stackedicon7); region iconstack1 = glyphsstack.create() .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.circle) .style("-fx-font-size: 12em; -fx-fill: linear-gradient(#70b4e5 0%, #247cbc 70%, #2c85c1 85%);") .build() ) .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.bitbucket) .style("-fx-font-size: 6em; " + "-fx-fill: linear-gradient(#ffffff 0%, #d2d2d2); " + "-fx-effect: dropshadow( one-pass-box , rgba(0,0,0,0.8) , 4 , 0.0 , 1 , 1 );") .build() ) .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.ban) .style("-fx-font-size: 12em; -fx-fill: red; -fx-opacity: 0.5;") .build() ); region iconstack3 = glyphsstack.create() .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.circle) .size("12em") .style("-fx-fill: linear-gradient(#70b4e5 0%, #247cbc 70%, #2c85c1 85%);") .build() ) .add(glyphsbuilder.create(weathericonview.class) .glyph(weathericon.rain) .size("4em") .style("-fx-fill: linear-gradient(#ffffff 0%, #d2d2d2); " + "-fx-effect: dropshadow( one-pass-box , rgba(0,0,0,0.8) , 4 , 0.0 , 1 , 1 );") .build() ) .add(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.ban) .size("12em") .style("-fx-fill: red; -fx-opacity: 0.5;") .build() ); region iconstack4 = glyphsstack.create() .addall(glyphsbuilder.create(fontawesomeiconview.class) .glyph(fontawesomeicon.circle) .size("12em") .style("-fx-fill: linear-gradient(#70b4e5 0%, #247cbc 70%, #2c85c1 85%);") .build(), glyphsbuilder.create(weathericonview.class) .glyph(weathericon.sunrise) .size("4em") .style("-fx-fill: linear-gradient(orange 0%, darkred); " + "-fx-effect: dropshadow( one-pass-box , rgba(0,0,0,0.8) , 4 , 0.0 , 1 , 1 );") .build() ); hbox stackiconbox2 = new hbox(); stackiconbox2.setspacing(5.0); stackiconbox2.setpadding(new insets(10.0)); stackiconbox2.getchildren().addall(iconstack1, iconstack3, iconstack4); hbox basiciconbox = new hbox(); basiciconbox.setalignment(pos.center); basiciconbox.setspacing(20.0); basiciconbox.getchildren().addall(thumbsupicon, thumbsdownicon, fontawesomeicon, weathericon1, weathericon2, testbutton, testbutton2, githublabel, ambulancelabel); root.getchildren().addall(createmenubar(), basiciconbox, starbutton, cloudbutton, togglebutton, stackiconbox1, stackiconbox2); scene scene = new scene(root); scene.getstylesheets().addall(glyphsstyle.default.getstylepath()); primarystage.setscene(scene); primarystage.settitle("fontawesomefx demo"); primarystage.show(); } private menubar createmenubar() { menubar menubar = new menubar(); menuitem openitem = new menuitem("open"); glyphsdude.seticon(openitem, fontawesomeicon.file); menuitem saveitem = new menuitem("save"); glyphsdude.seticon(saveitem, fontawesomeicon.download); menuitem saveasitem = new menuitem("save as..."); glyphsdude.seticon(saveasitem, fontawesomeicon.download); menuitem exititem = new menuitem("exit"); glyphsdude.seticon(exititem, fontawesomeicon.sign_out); menu menufile = new menu("file"); menufile.getitems().add(openitem); menufile.getitems().add(saveitem); menufile.getitems().add(saveasitem); menufile.getitems().add(new separatormenuitem()); menufile.getitems().add(exititem); menu menuedit = new menu("edit"); menu menuview = new menu("view"); menubar.getmenus().addall(menufile, menuedit, menuview); return menubar; } public static void main(string[] args) { system.setproperty("prism.lcdtext", "false"); launch(args); } } update
done same thing in ubuntu 15.04 x64 oracle jdk 1.8.0_45 installed , works:










Comments
Post a Comment