Search in sources :

Example 31 with FXMLLoader

use of javafx.fxml.FXMLLoader in project swift by luastar.

the class MybatisGenApp method initRootLayout.

public void initRootLayout() {
    try {
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(getClass().getResource("/views/mybatis_gen.fxml"));
        rootLayout = loader.load();
        // Show the scene containing the root layout.
        Scene scene = new Scene(rootLayout);
        primaryStage.setScene(scene);
        primaryStage.show();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : IOException(java.io.IOException) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader)

Example 32 with FXMLLoader

use of javafx.fxml.FXMLLoader in project Gargoyle by callakrsos.

the class FilePropertiesComposite method init.

void init() {
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(FilePropertiesComposite.class.getResource("FilePropertiesCompositeView.fxml"));
    loader.setRoot(this);
    loader.setController(this);
    try {
        loader.load();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : IOException(java.io.IOException) FXMLLoader(javafx.fxml.FXMLLoader)

Example 33 with FXMLLoader

use of javafx.fxml.FXMLLoader in project Gargoyle by callakrsos.

the class FXMLPreviewLoader method start.

/**
	 * @inheritDoc
	 */
@Override
public void start(Stage primaryStage) throws Exception {
    BorderPane borderPane = new BorderPane();
    FXMLLoader loader = new FXMLLoader() {
    };
    // InputStream resourceAsStream =
    // FXMLPreviewLoader.class.getResourceAsStream("lang_ko.properties");
    //
    // loader.setResources(new PropertyResourceBundle(new
    // InputStreamReader(resourceAsStream, "UTF-8")) {
    // /*
    // * @inheritDoc
    // */
    // @Override
    // public boolean containsKey(String key) {
    // return true;
    // }
    //
    // /*
    // * @inheritDoc
    // */
    // @Override
    // public Object handleGetObject(String key) {
    // if (key == null) {
    // return "";
    // }
    //
    // Object result = null;
    //
    // try {
    // result = super.handleGetObject(key);
    // } catch (Exception e) {
    // ;
    // }
    //
    // return (result == null) ? key : result;
    // }
    // });
    // loader.setLocation(/*FXMLPreviewLoader.class.getResource("ColumnExam3.fxml")*/url);
    loader.setBuilderFactory(new BuilderFactory() {

        @Override
        public Builder<?> getBuilder(Class<?> param) {
            return new JavaFXBuilderFactory().getBuilder(param);
        }
    });
    loader.setControllerFactory(new Callback<Class<?>, Object>() {

        @Override
        public Object call(Class<?> param) {
            return null;
        }
    });
    FileInputStream inputStream = new FileInputStream(file);
    InputStream is = null;
    try {
        SAXParserFactory spf = SAXParserFactory.newInstance();
        SAXParser sp = spf.newSAXParser();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        FXMLSaxHandler handler = new FXMLSaxHandler(out);
        sp.parse(inputStream, handler);
        String string = out.toString("UTF-8");
        string = ValueUtil.regexReplaceMatchs("<!\\[CDATA\\[[?<a-zA-Z. *?>]+]]>", string, str -> {
            return ValueUtil.regexMatch("<\\?import [a-zA-Z.*?]+>", str);
        });
        System.out.println(string);
        byte[] bytes = string.getBytes();
        is = new ByteArrayInputStream(bytes);
    } catch (Exception e) {
        e.printStackTrace();
    }
    // FileInputStream inputStream = new FileInputStream(file);
    borderPane.setCenter(loader.load(is));
    Scene scene = new Scene(borderPane);
    primaryStage.setScene(scene);
    primaryStage.show();
}
Also used : JavaFXBuilderFactory(javafx.fxml.JavaFXBuilderFactory) FXMLSaxHandler(com.kyj.fx.voeditor.visual.framework.parser.FXMLSaxHandler) FXMLSaxHandler(com.kyj.fx.voeditor.visual.framework.parser.FXMLSaxHandler) Scene(javafx.scene.Scene) ByteArrayOutputStream(java.io.ByteArrayOutputStream) JavaFXBuilderFactory(javafx.fxml.JavaFXBuilderFactory) SAXParserFactory(javax.xml.parsers.SAXParserFactory) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) FileInputStream(java.io.FileInputStream) File(java.io.File) FileNotFoundException(java.io.FileNotFoundException) Application(javafx.application.Application) Matcher(java.util.regex.Matcher) ByteArrayInputStream(java.io.ByteArrayInputStream) Stage(javafx.stage.Stage) FXMLLoader(javafx.fxml.FXMLLoader) SAXParser(javax.xml.parsers.SAXParser) Pattern(java.util.regex.Pattern) BorderPane(javafx.scene.layout.BorderPane) BuilderFactory(javafx.util.BuilderFactory) Callback(javafx.util.Callback) Builder(javafx.util.Builder) InputStream(java.io.InputStream) BorderPane(javafx.scene.layout.BorderPane) FileInputStream(java.io.FileInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) Builder(javafx.util.Builder) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) JavaFXBuilderFactory(javafx.fxml.JavaFXBuilderFactory) BuilderFactory(javafx.util.BuilderFactory) FileInputStream(java.io.FileInputStream) FileNotFoundException(java.io.FileNotFoundException) ByteArrayInputStream(java.io.ByteArrayInputStream) SAXParser(javax.xml.parsers.SAXParser) SAXParserFactory(javax.xml.parsers.SAXParserFactory)

Example 34 with FXMLLoader

use of javafx.fxml.FXMLLoader in project Gargoyle by callakrsos.

the class FileCompareExam method start.

@Override
public void start(Stage primaryStage) throws Exception {
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(DiffAppController.class.getResource("FileBaseDiffApp.fxml"));
    BorderPane load = loader.load();
    FileBaseDiffAppController controller = loader.getController();
    URL resource1 = FileCompareExam.class.getResource("Test1");
    URL resource2 = FileCompareExam.class.getResource("Test2");
    File ordinalFile = new File(resource1.toURI());
    controller.setDiffFile(ordinalFile, new File(resource2.toURI()));
    Scene scene = new Scene(load);
    primaryStage.setScene(scene);
    primaryStage.show();
}
Also used : FileBaseDiffAppController(com.kyj.fx.voeditor.visual.component.FileBaseDiffAppController) DiffAppController(com.kyj.fx.voeditor.visual.component.DiffAppController) FileBaseDiffAppController(com.kyj.fx.voeditor.visual.component.FileBaseDiffAppController) BorderPane(javafx.scene.layout.BorderPane) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) File(java.io.File) URL(java.net.URL)

Example 35 with FXMLLoader

use of javafx.fxml.FXMLLoader in project Gargoyle by callakrsos.

the class ColumnExample3 method start.

@Override
public void start(Stage primaryStage) throws IOException {
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(getClass().getResource("ColumnExam3.fxml"));
    primaryStage.setTitle("Column Resize Test");
    primaryStage.setScene(new Scene(new BorderPane(loader.load()), 1100, 700));
    primaryStage.sizeToScene();
    primaryStage.show();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader)

Aggregations

FXMLLoader (javafx.fxml.FXMLLoader)252 IOException (java.io.IOException)148 Scene (javafx.scene.Scene)120 Parent (javafx.scene.Parent)79 Stage (javafx.stage.Stage)64 FXML (javafx.fxml.FXML)46 URL (java.net.URL)43 Pane (javafx.scene.layout.Pane)34 BorderPane (javafx.scene.layout.BorderPane)30 AnchorPane (javafx.scene.layout.AnchorPane)24 ActionEvent (javafx.event.ActionEvent)19 ResourceBundle (java.util.ResourceBundle)16 Initializable (javafx.fxml.Initializable)14 JFXButton (com.jfoenix.controls.JFXButton)13 KeyFrame (javafx.animation.KeyFrame)13 Timeline (javafx.animation.Timeline)13 StackPane (javafx.scene.layout.StackPane)13 Duration (javafx.util.Duration)13 Level (java.util.logging.Level)12 Logger (java.util.logging.Logger)12