简体   繁体   English

JavaFX FXML应用程序作为applet

[英]JavaFX FXML application as applet

I have a very simple JavaFX FXML application (an anchor pane with two buttons and a label: one button print a string and the other exit application). 我有一个非常简单的JavaFX FXML应用程序(一个带有两个按钮和一个标签的锚窗格:一个按钮显示一个字符串,另一个按钮显示一个出口应用程序)。

I would like to run this application as applet for testing purpose. 我想将此应用程序作为applet运行以进行测试。

Since I am completely new to this process, can someone help me about how and what to do to deploy my application in a server web space so it can be used by the client side without download the application? 由于我是这个过程的新手,因此有人可以帮助我如何以及如何在服务器Web空间中部署应用程序,以便客户端无需下载应用程序即可使用它吗?

Thanks all 谢谢大家

in .FXML 在.FXML中

..xmlns:fx="http://javafx.com/fxml" fx:controller="DIRECTORY.controler"> //controler.java

in .java (Main.java) 在.java(Main.java)中

public static void main(String[] args) {
    launch(args);
}

@Override
public void start(final Stage primaryStage) {

    BorderPane pane = null;
    try {
        pane = (BorderPane) FXMLLoader.load(MAIN.class.getResource("FILE.fxml"));
        pane.getStyleClass().add("main");
    } catch (IOException ex) {

        Logger.getLogger(MAIN.class.getName()).log(Level.SEVERE, null, ex);
        System.exit(-1);
    }

    primaryStage.setScene(new Scene(pane, 1100, 620));
    primaryStage.getScene().getStylesheets().add(MAIN.class.getResource("FILE.css").toExternalForm());
    primaryStage.centerOnScreen();
    primaryStage.setTitle("Title");
    primaryStage.show();


}

in .java (controler.java) 在.java(controler.java)中

public class controler implements Initializable {

@FXML
private WebView browser;
@FXML
private Button back, refresh, home;
@FXML
private ComboBox CB;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM