load elusive icon font at startup

This commit is contained in:
Andreas Billmann
2015-03-25 01:16:18 +01:00
parent 03575c8620
commit beea49a6fc
4 changed files with 20 additions and 3 deletions

View File

@@ -83,6 +83,17 @@ public class GeoFroggerFX extends Application {
private void showUI(Stage primaryStage, String name, String version) { private void showUI(Stage primaryStage, String name, String version) {
GeoFroggerFXController geoFroggerFXController = appContext.getBean(GeoFroggerFXController.class); GeoFroggerFXController geoFroggerFXController = appContext.getBean(GeoFroggerFXController.class);
Scene scene = new Scene((Parent) geoFroggerFXController.getView()); Scene scene = new Scene((Parent) geoFroggerFXController.getView());
scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
if (isScenicViewShortcutPressed(event)) {
// ScenicView.show(scene);
}
}
});
primaryStage.setScene(scene); primaryStage.setScene(scene);
primaryStage.setTitle(String.format("%s %s", name, version)); primaryStage.setTitle(String.format("%s %s", name, version));
primaryStage.show(); primaryStage.show();
@@ -90,5 +101,10 @@ public class GeoFroggerFX extends Application {
private void loadCustomFonts() { private void loadCustomFonts() {
Font.loadFont(GeoFroggerFX.class.getResource("/fonts/sofia/Sofia-Regular.otf").toExternalForm(), 24); Font.loadFont(GeoFroggerFX.class.getResource("/fonts/sofia/Sofia-Regular.otf").toExternalForm(), 24);
Font.loadFont(GeoFroggerFX.class.getResource("/fonts/elusive/Elusive-Icons.ttf").toExternalForm(), 10);
}
private static boolean isScenicViewShortcutPressed(final KeyEvent keyEvent) {
return keyEvent.isAltDown() && keyEvent.isControlDown() && keyEvent.getCode().equals(KeyCode.V);
} }
} }

View File

@@ -27,6 +27,7 @@ package de.geofroggerfx.ui;
import de.geofroggerfx.model.Attribute; import de.geofroggerfx.model.Attribute;
import de.geofroggerfx.model.Type; import de.geofroggerfx.model.Type;
import de.geofroggerfx.ui.glyphs.ElusiveIcons;
import de.jensd.fx.glyphs.GlyphIcon; import de.jensd.fx.glyphs.GlyphIcon;
import de.jensd.fx.glyphs.GlyphIcons; import de.jensd.fx.glyphs.GlyphIcons;
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcons; import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcons;

View File

@@ -8,7 +8,4 @@ import javafx.scene.text.Font;
*/ */
public class GeofroggerGlyphsDude extends GlyphsDude { public class GeofroggerGlyphsDude extends GlyphsDude {
static {
Font.loadFont(GeofroggerGlyphsDude.class.getResource(ElusiveIcon.TTF_PATH).toExternalForm(), 10.0);
}
} }

View File

@@ -18,6 +18,7 @@
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon?> <?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon?>
<?import com.lynden.gmapsfx.GoogleMapView?> <?import com.lynden.gmapsfx.GoogleMapView?>
<?import de.geofroggerfx.ui.glyphs.ElusiveIcon?>
<BorderPane layoutX="10.0" layoutY="10.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="600" minWidth="400" <BorderPane layoutX="10.0" layoutY="10.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="600" minWidth="400"
style="-fx-background-color: #ffffff;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" style="-fx-background-color: #ffffff;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8.0.40" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8.0.40"
@@ -29,6 +30,8 @@
<content> <content>
<FlowPane fx:id="attributeList" hgap="4.0" prefWidth="200.0" vgap="4.0"> <FlowPane fx:id="attributeList" hgap="4.0" prefWidth="200.0" vgap="4.0">
<children> <children>
<!--<FontAwesomeIcon glyphName="CAR" size="1.6em"/>-->
<!--<ElusiveIcon glyphName="YOUTUBE" size="1.6em"/>-->
</children> </children>
<opaqueInsets> <opaqueInsets>
<Insets/> <Insets/>