| 1 |
/** |
| 2 |
* Copyright (c) 2015 Jens Deters http://www.jensd.de |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at |
| 5 |
* |
| 6 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 7 |
* |
| 8 |
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 9 |
* KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. |
| 10 |
* |
| 11 |
*/ |
| 12 |
package de.jensd.fx.glyphs.fontawesome.demo; |
| 13 |
|
| 14 |
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon; |
| 15 |
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView; |
| 16 |
import de.jensd.fx.glyphs.fontawesome.utils.FontAwesomeIconFactory; |
| 17 |
import javafx.application.Application; |
| 18 |
import javafx.scene.Scene; |
| 19 |
import javafx.scene.control.ContentDisplay; |
| 20 |
import javafx.scene.control.ScrollPane; |
| 21 |
import javafx.scene.control.ToggleButton; |
| 22 |
import javafx.scene.layout.FlowPane; |
| 23 |
import javafx.scene.layout.HBox; |
| 24 |
import javafx.stage.Stage; |
| 25 |
|
| 26 |
/** |
| 27 |
* |
| 28 |
* @author Jens Deters |
| 29 |
*/ |
| 30 |
public class FontAwesomeIconsDemoApp extends Application { |
| 31 |
|
| 32 |
@Override |
| 33 |
public void start(Stage primaryStage) throws Exception { |
| 34 |
|
| 35 |
HBox buttonBox1 = new HBox(); |
| 36 |
for (int i = 0; i < 10; i++) { |
| 37 |
ToggleButton toggle1 = new ToggleButton(); |
| 38 |
FontAwesomeIconView iconView = new FontAwesomeIconView(FontAwesomeIcon.ANGELLIST); |
| 39 |
//iconView.setGlyphSize(42.0); |
| 40 |
toggle1.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); |
| 41 |
toggle1.setGraphic(iconView); |
| 42 |
buttonBox1.getChildren().add(toggle1); |
| 43 |
} |
| 44 |
|
| 45 |
HBox buttonBox2 = new HBox(); |
| 46 |
for (int i = 0; i < 10; i++) { |
| 47 |
ToggleButton toggle1 = FontAwesomeIconFactory.get().createIconToggleButton(FontAwesomeIcon.ANGELLIST, "", "2em"); |
| 48 |
buttonBox2.getChildren().add(toggle1); |
| 49 |
} |
| 50 |
|
| 51 |
FlowPane iconsPane = new FlowPane(3, 3); |
| 52 |
iconsPane.getChildren().add(buttonBox1); |
| 53 |
iconsPane.getChildren().add(buttonBox2); |
| 54 |
for (FontAwesomeIcon icon : FontAwesomeIcon.values()) { |
| 55 |
iconsPane.getChildren().add(FontAwesomeIconFactory.get().createIcon(icon, "3em")); |
| 56 |
} |
| 57 |
Scene scene = new Scene(new ScrollPane(iconsPane), 500, 500); |
| 58 |
primaryStage.setScene(scene); |
| 59 |
primaryStage.setTitle("FontAwesomeFX: FontAwesomeIcons Demo: " + FontAwesomeIcon.values().length + " Icons"); |
| 60 |
primaryStage.show(); |
| 61 |
|
| 62 |
} |
| 63 |
|
| 64 |
public static void main(String[] args) { |
| 65 |
launch(args); |
| 66 |
} |
| 67 |
} |