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);
}
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);
});
}
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();
}
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();
}
}
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;
}
Aggregations