| 1 |
package de.jensd.fx.glyphs.fontawesome.demo; |
| 2 |
|
| 3 |
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView; |
| 4 |
import java.io.File; |
| 5 |
import java.io.FileInputStream; |
| 6 |
import java.io.FileNotFoundException; |
| 7 |
import javafx.application.Application; |
| 8 |
import javafx.application.Platform; |
| 9 |
import javafx.scene.text.Font; |
| 10 |
import javafx.stage.Stage; |
| 11 |
|
| 12 |
public class FontTestFX extends Application { |
| 13 |
|
| 14 |
private void loadFont(String fileName) { |
| 15 |
try { |
| 16 |
FileInputStream fontFile = new FileInputStream(new File(fileName)); |
| 17 |
Font.loadFont(fontFile, 16); |
| 18 |
} catch (FileNotFoundException ex) { |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
@Override |
| 23 |
public void start(Stage primaryStage) { |
| 24 |
String fileName = FontAwesomeIconView.TTF_PATH; |
| 25 |
loadFont(fileName); |
| 26 |
loadFont(fileName); |
| 27 |
Platform.exit(); |
| 28 |
} |
| 29 |
|
| 30 |
public static void main(String[] args) { |
| 31 |
launch(args); |
| 32 |
} |
| 33 |
} |