5_jfoenix_运行jfoenix官方演示,切换片段,部署

原文链接: https://juejin.im/post/5ced62595188251a115f43ac

1_运行jfoenix官方演示


2_切换片段


.button:focused{
     -fx-background-color: #26282C;
     -fx-border-width: 0 0 0 2;
     -fx-border-color: #33ffff;
}
复制代码

package sample;

import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXToolbar;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.input.MouseEvent;

import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;

public class Controller implements Initializable {
    @FXML
    private JFXToolbar jfxtoolbar;
    @FXML
    private JFXButton jfxbutton1;

    @FXML
    private JFXButton jfxbutton2;

    @FXML
    void U1(MouseEvent event) {
        loadUI("U1");
        jfxbutton1.setStyle(".button:{\n" +
                "     -fx-background-color: #26282C;\n" +
                "     -fx-border-width: 0 0 0 2;\n" +
                "     -fx-border-color: #33ffff;\n" +
                "}");
        jfxbutton2.setStyle(".button:{\n" +
                "     -fx-background-color: #26282C;\n" +
                "     -fx-border-width: 0 0 0 0;\n" +
                "     -fx-border-color: #33ffff;\n" +
                "}");
    }

    @FXML
    void U2(MouseEvent event) {
        loadUI("U2");
        jfxbutton1.setStyle(".button:{\n" +
                "     -fx-background-color: #26282C;\n" +
                "     -fx-border-width: 0 0 0 0;\n" +
                "     -fx-border-color: #33ffff;\n" +
                "}");
        jfxbutton2.setStyle(".button:{\n" +
                "     -fx-background-color: #26282C;\n" +
                "     -fx-border-width: 0 0 0 2;\n" +
                "     -fx-border-color: #33ffff;\n" +
                "}");
    }

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        loadUI("U1");
        jfxbutton1.setStyle(".button:{\n" +
                "     -fx-background-color: #26282C;\n" +
                "     -fx-border-width: 0 0 0 2;\n" +
                "     -fx-border-color: #33ffff;\n" +
                "}");
    }

    private void loadUI(String ui) {
        Parent root = null;
        try {
            root = FXMLLoader.load(getClass().getResource("FXML/" + ui + ".fxml"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        jfxtoolbar.setCenter(root);
    }

}
复制代码

3_部署


inno setup官网

注意要下载inno setup V5.x版本
系统环境变量 PATH C:\Program Files (x86)\Inno Setup 5

图片转ICO图标

详细请参考这个视频

转载于:https://juejin.im/post/5ced62595188251a115f43ac

你可能感兴趣的:(5_jfoenix_运行jfoenix官方演示,切换片段,部署)