我尝试在Intelij上使用Glisten Afterburner框架创建一个Gluon Mobile应用程序,但是一旦我创建它,我甚至无法启动它。
我的fxml代码是默认生成的代码:
<?xml version="1.0" encoding="UTF-8"?>
<?import com.gluonhq.charm.glisten.control.Icon?>
<?import com.gluonhq.charm.glisten.mvc.View?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.VBox?>
<View fx:id="primary" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="350.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.gluon.attempt.views.PrimaryPresenter">
<center>
<VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0" spacing="15.0" BorderPane.alignment="CENTER">
<children>
<Label fx:id="label" text="%label.text.1" />
<Button mnemonicParsing="false" onAction="#buttonClick" text="%button.text">
<graphic>
<Icon content="LANGUAGE" />
</graphic>
</Button>
</children>
</VBox>
</center>
</View>
ApplicationCode:
package com.gluon.attempt;
import com.gluon.attempt.views.AppViewManager;
import com.gluonhq.charm.glisten.application.MobileApplication;
import com.gluonhq.charm.glisten.visual.Swatch;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
public class Attempt extends MobileApplication {
@Override
public void init() {
AppViewManager.registerViewsAndDrawer(this);
}
@Override
public void postInit(Scene scene) {
Swatch.BLUE.assignTo(scene);
((Stage) scene.getWindow()).getIcons().add(new Image(Attempt.class.getResourceAsStream("/icon.png")));
}
}