Search in sources :

Example 1 with JFXDecorator

use of com.jfoenix.controls.JFXDecorator in project JFoenix by jfoenixadmin.

the class MainDemo method start.

@Override
public void start(Stage stage) throws Exception {
    new Thread(() -> {
        try {
            SVGGlyphLoader.loadGlyphsFont(MainDemo.class.getResourceAsStream("/fonts/icomoon.svg"), "icomoon.svg");
        } catch (IOException ioExc) {
            ioExc.printStackTrace();
        }
    }).start();
    Flow flow = new Flow(MainController.class);
    DefaultFlowContainer container = new DefaultFlowContainer();
    flowContext = new ViewFlowContext();
    flowContext.register("Stage", stage);
    flow.createHandler(flowContext).start(container);
    JFXDecorator decorator = new JFXDecorator(stage, container.getView());
    decorator.setCustomMaximize(true);
    decorator.setGraphic(new SVGGlyph(""));
    stage.setTitle("JFoenix Demo");
    double width = 800;
    double height = 600;
    try {
        Rectangle2D bounds = Screen.getScreens().get(0).getBounds();
        width = bounds.getWidth() / 2.5;
        height = bounds.getHeight() / 1.35;
    } catch (Exception e) {
    }
    Scene scene = new Scene(decorator, width, height);
    final ObservableList<String> stylesheets = scene.getStylesheets();
    stylesheets.addAll(JFoenixResources.load("css/jfoenix-fonts.css").toExternalForm(), JFoenixResources.load("css/jfoenix-design.css").toExternalForm(), MainDemo.class.getResource("/css/jfoenix-main-demo.css").toExternalForm());
    stage.setScene(scene);
    stage.show();
}
Also used : DefaultFlowContainer(io.datafx.controller.flow.container.DefaultFlowContainer) ViewFlowContext(io.datafx.controller.flow.context.ViewFlowContext) FXMLViewFlowContext(io.datafx.controller.flow.context.FXMLViewFlowContext) Rectangle2D(javafx.geometry.Rectangle2D) IOException(java.io.IOException) Scene(javafx.scene.Scene) IOException(java.io.IOException) Flow(io.datafx.controller.flow.Flow) JFXDecorator(com.jfoenix.controls.JFXDecorator) SVGGlyph(com.jfoenix.svg.SVGGlyph)

Aggregations

JFXDecorator (com.jfoenix.controls.JFXDecorator)1 SVGGlyph (com.jfoenix.svg.SVGGlyph)1 Flow (io.datafx.controller.flow.Flow)1 DefaultFlowContainer (io.datafx.controller.flow.container.DefaultFlowContainer)1 FXMLViewFlowContext (io.datafx.controller.flow.context.FXMLViewFlowContext)1 ViewFlowContext (io.datafx.controller.flow.context.ViewFlowContext)1 IOException (java.io.IOException)1 Rectangle2D (javafx.geometry.Rectangle2D)1 Scene (javafx.scene.Scene)1