Search in sources :

Example 6 with Region

use of javafx.scene.layout.Region in project aic-praise by aic-sri-international.

the class FXUtil method setButtonStackedIcons.

public static void setButtonStackedIcons(Button button, GlyphIcons icon1, GlyphIcons icon2) {
    Region saveAsImg = GlyphsStack.create().add(GlyphsBuilder.create(FontAwesomeIcon.class).glyph(icon1).size(iconSize(_buttonDefaultIconSize)).build()).add(GlyphsBuilder.create(FontAwesomeIcon.class).glyph(icon2).size(iconSize(_iconSmallSize)).build());
    button.setGraphic(saveAsImg);
    button.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
    fixButtonSize(button, _buttonDefaultIconSize);
}
Also used : Region(javafx.scene.layout.Region) FontAwesomeIcon(de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon)

Example 7 with Region

use of javafx.scene.layout.Region in project TeachingInSimulation by ScOrPiOzzy.

the class Application method run.

@Override
public void run(ApplicationArguments args) throws Exception {
    // 初始化JxBrowser信息
    Refine.init();
    // 同步模型文件
    new Thread(() -> {
        List<String> pathArray = new ArrayList<>();
        try {
            ftpUtils.connect("/assets");
            ftpUtils.getPath("/assets", pathArray);
            ftpUtils.download(pathArray, "./");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            ftpUtils.disconnect();
        }
    }).start();
    launchApplicationView((ConfigurableApplicationContext) applicationContext);
    Platform.runLater(() -> {
        Stage stage = new Stage(StageStyle.TRANSPARENT);
        try {
            start(stage);
        } catch (Exception e) {
            e.printStackTrace();
        }
        Scene scene = new Scene(new Region());
        Preferences prefs = Preferences.userRoot().node(SettingConsts.REG_APP_PATH);
        // 分辨率
        int width = prefs.getInt(SettingConsts.RESOLUTION_WIDTH, 1366);
        int height = prefs.getInt(SettingConsts.RESOLUTION_HEIGHT, 768);
        stage.setWidth(width);
        stage.setHeight(height);
        LoggerFactory.getLogger(getClass()).info("窗口大小:{}x{}", width, height);
        stage.setFullScreen(prefs.getBoolean(SettingConsts.SCREEN_MODE, false));
        LoggerFactory.getLogger(getClass()).info("窗口全屏:{}", stage.isFullScreen());
        stage.setOnCloseRequest(value -> {
            AlertUtil.showConfirm(MsgUtil.getMessage("alert.confirmation.exit"), resp -> {
                if (resp == ButtonType.YES) {
                    Platform.exit();
                    System.exit(0);
                } else {
                    value.consume();
                }
            });
        });
        scene.setFill(null);
        GUIState.setScene(scene);
        showView(HomeView.class);
    });
}
Also used : Stage(javafx.stage.Stage) Region(javafx.scene.layout.Region) ArrayList(java.util.ArrayList) List(java.util.List) Scene(javafx.scene.Scene) Preferences(java.util.prefs.Preferences) BeansException(org.springframework.beans.BeansException)

Example 8 with Region

use of javafx.scene.layout.Region in project TeachingInSimulation by ScOrPiOzzy.

the class LoginApp method start.

@Override
public void start(Stage primaryStage) throws Exception {
    // 窗口无装饰
    primaryStage.initStyle(StageStyle.TRANSPARENT);
    FXMLLoader loader = new FXMLLoader();
    loader.setResources(ResourceBundle.getBundle("i18n/messages"));
    Region loginView = loader.load(LoginApp.class.getResourceAsStream("/view/Login.fxml"));
    LoginController loginController = loader.getController();
    loader = new FXMLLoader();
    loader.setResources(ResourceBundle.getBundle("i18n/messages"));
    Region settingView = loader.load(LoginApp.class.getResourceAsStream("/view/Network.fxml"));
    NetworkController settingController = loader.getController();
    // 手动注入
    settingController.setLoginView(loginView);
    // 
    loginController.setSettingView(settingView);
    // 背景无填充
    Scene scene = new Scene(loginView);
    scene.setOnMouseDragged(e -> {
        primaryStage.setX(e.getScreenX() + xOffset);
        primaryStage.setY(e.getScreenY() + yOffset);
    });
    scene.setOnMousePressed(e -> {
        // 按下鼠标后,记录当前鼠标的坐标
        xOffset = primaryStage.getX() - e.getScreenX();
        yOffset = primaryStage.getY() - e.getScreenY();
    });
    scene.setFill(null);
    primaryStage.setScene(scene);
    primaryStage.show();
}
Also used : LoginController(com.cas.sim.tis.view.controller.LoginController) Region(javafx.scene.layout.Region) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) NetworkController(com.cas.sim.tis.view.controller.NetworkController)

Example 9 with Region

use of javafx.scene.layout.Region in project TeachingInSimulation by ScOrPiOzzy.

the class TypicalCaseBtnController method showDrawingWin.

@FXML
private void showDrawingWin(ActionEvent event) {
    ((Button) event.getSource()).setDisable(true);
    try {
        if (drawingWin == null) {
            drawingWin = new Stage();
            drawingWin.initStyle(StageStyle.TRANSPARENT);
            drawingWin.setX(GUIState.getStage().getX() + 100);
            drawingWin.setY(GUIState.getStage().getY() + 100);
            FXMLLoader loader = new FXMLLoader();
            loader.setResources(ResourceBundle.getBundle("i18n/messages"));
            Region root = loader.load(TypicalCaseBtnController.class.getResourceAsStream("/view/jme/Drawing.fxml"));
            DrawingController controller = loader.getController();
            controller.setStage(drawingWin);
            controller.setUI(typicalCase3D);
            Scene scene = new Scene(root);
            drawingWin.setScene(scene);
            drawingWin.setOnHidden(e -> {
                ((Button) event.getSource()).setDisable(false);
            });
        }
        drawingWin.show();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : Button(javafx.scene.control.Button) Stage(javafx.stage.Stage) Region(javafx.scene.layout.Region) IOException(java.io.IOException) DrawingController(com.cas.sim.tis.view.controller.DrawingController) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) FXML(javafx.fxml.FXML)

Example 10 with Region

use of javafx.scene.layout.Region in project TeachingInSimulation by ScOrPiOzzy.

the class TypicalCaseMenu method getLeftContent.

@Override
public Region getLeftContent() {
    VBox vb = new VBox(10);
    Button create = createMenu(MsgUtil.getMessage("menu.button.new"), new SVGGlyph("iconfont.svg.new", Color.WHITE, 32));
    create.setOnMouseClicked(e -> newCase());
    Button open = createMenu(MsgUtil.getMessage("menu.button.open"), new SVGGlyph("iconfont.svg.open", Color.WHITE, 32));
    open.setOnMouseClicked(e -> showCaseDialog());
    Button save = createMenu(MsgUtil.getMessage("menu.button.save"), new SVGGlyph("iconfont.svg.save", Color.WHITE, 32));
    save.setOnMouseClicked(e -> saveCase());
    HBox menu = new HBox(22, create, open, save);
    menu.setAlignment(Pos.CENTER);
    // 菜单
    vb.getChildren().add(menu);
    vb.getChildren().add(new ElecCompTree(elecComp -> typicalCase3D.selectedElecComp(elecComp)));
    return vb;
}
Also used : Button(javafx.scene.control.Button) Pos(javafx.geometry.Pos) HBox(javafx.scene.layout.HBox) Color(javafx.scene.paint.Color) PageController(com.cas.sim.tis.view.controller.PageController) Node(javafx.scene.Node) TypicalCaseAction(com.cas.sim.tis.action.TypicalCaseAction) Font(javafx.scene.text.Font) TypicalCase(com.cas.sim.tis.entity.TypicalCase) VBox(javafx.scene.layout.VBox) SVGGlyph(com.cas.sim.tis.svg.SVGGlyph) AlertUtil(com.cas.sim.tis.util.AlertUtil) Region(javafx.scene.layout.Region) AlertType(javafx.scene.control.Alert.AlertType) TextInputDialog(javafx.scene.control.TextInputDialog) ILeftContent(com.cas.sim.tis.view.control.ILeftContent) Optional(java.util.Optional) SpringUtil(com.cas.sim.tis.util.SpringUtil) Dialog(com.cas.sim.tis.view.control.imp.dialog.Dialog) MsgUtil(com.cas.sim.tis.util.MsgUtil) TypicalCaseSelectDialog(com.cas.sim.tis.view.control.imp.preparation.TypicalCaseSelectDialog) ContentDisplay(javafx.scene.control.ContentDisplay) HBox(javafx.scene.layout.HBox) SVGGlyph(com.cas.sim.tis.svg.SVGGlyph) Button(javafx.scene.control.Button) VBox(javafx.scene.layout.VBox)

Aggregations

Region (javafx.scene.layout.Region)106 Text (javafx.scene.text.Text)25 VBox (javafx.scene.layout.VBox)22 Label (javafx.scene.control.Label)21 Pane (javafx.scene.layout.Pane)21 Button (javafx.scene.control.Button)18 InnerShadow (javafx.scene.effect.InnerShadow)17 Scene (javafx.scene.Scene)16 Node (javafx.scene.Node)15 Insets (javafx.geometry.Insets)14 HBox (javafx.scene.layout.HBox)14 DropShadow (javafx.scene.effect.DropShadow)13 ArrayList (java.util.ArrayList)12 StackPane (javafx.scene.layout.StackPane)12 Canvas (javafx.scene.canvas.Canvas)11 Color (javafx.scene.paint.Color)11 GridPane (javafx.scene.layout.GridPane)10 Group (javafx.scene.Group)9 Background (javafx.scene.layout.Background)8 BackgroundFill (javafx.scene.layout.BackgroundFill)8