我试图在 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>
申请代码:
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")));
}
}