/** * Creates stage by calling createScene and with almost every properties of object. * * @see GenericView#createScene() * @see javafx.stage.Stage * @return * @throws IOException */ public Stage createStage() throws IOException { Stage stage = new Stage(); if (this.getTitle() != null) stage.setTitle(this.getTitle()); stage.setScene(this.createScene()); stage.setResizable(this.isResizable()); stage.setMaximized(this.isMaximized()); stage.setFullScreen(this.isFullscreen()); stage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH); if (!this.isDecorated()) stage.initStyle(StageStyle.UNDECORATED); if (this.isModal()) stage.initModality(Modality.APPLICATION_MODAL); if (this.getIcon() != null) stage.getIcons().add(this.getIcon()); if (this.getIcon() == null && GenericView.getGlobalIcon() != null) stage.getIcons().add(GenericView.getGlobalIcon()); return stage; }
public void loadTopsoilWindow(double x, double y) { Pane topsoilPlotUI = topsoilPlot.initializePlotPane(); Scene topsoilPlotScene = new Scene(topsoilPlotUI, 600, 600); topsoilPlotWindow = new Stage(StageStyle.DECORATED); // center on Squid topsoilPlotWindow.setX(x); topsoilPlotWindow.setY(y); topsoilPlotWindow.setResizable(true); topsoilPlotWindow.setScene(topsoilPlotScene); topsoilPlotWindow.setTitle("Topsoil Plot"); topsoilPlotWindow.requestFocus(); topsoilPlotWindow.initOwner(null); topsoilPlotWindow.initModality(Modality.NONE); topsoilPlotWindow.show(); }
/** * Creates an instance of a {@link AboutView}. * * @throws IOException if unable to load the controller */ @Inject public AboutView(final FXMLLoader fxmlLoader) throws UIInitialisationException, IOException { stage = new Stage(); stage.initStyle(StageStyle.UNDECORATED); stage.setResizable(false); final URL resource = getClass().getResource(ABOUT_VIEW); fxmlLoader.setLocation(resource); final Scene rootScene = new Scene(fxmlLoader.load()); rootScene.addEventHandler(KeyEvent.KEY_PRESSED, event -> { if (event.getCode() == KeyCode.ESCAPE) { stage.hide(); } }); stage.setScene(rootScene); stage.focusedProperty().addListener((observable, oldValue, newValue) -> { if (!newValue) { stage.hide(); } }); }
@FXML private void loadImageArchiveEditor() { try { FXMLLoader loader = new FXMLLoader(App.class.getResource("/ImageArchiveUI.fxml")); Parent root = loader.load(); ImageArchiveController controller = loader.getController(); Stage stage = new Stage(); controller.setStage(stage); stage.setTitle("Image Archive Editor"); Scene scene = new Scene(root); scene.getStylesheets().add(App.class.getResource("/style.css").toExternalForm()); stage.getIcons().add(new Image(getClass().getResourceAsStream("/icons/app_icon_128.png"))); stage.setScene(scene); stage.initStyle(StageStyle.TRANSPARENT); stage.setResizable(false); stage.centerOnScreen(); stage.setTitle("Archive Editor"); stage.show(); } catch (IOException e) { e.printStackTrace(); } }
@Override public void start(final Stage stage) throws Exception { GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); int width = gd.getDisplayMode().getWidth(); int height = gd.getDisplayMode().getHeight(); Scene scene = new Scene(FXMLLoader.load(UDEDesktop.class.getResource("resources/UDEDesktopWindow.fxml")), width, height); scene.setFill(null); scene.getStylesheets().add("resources/stylesheet.css"); stage.setScene(scene); // stage.initStyle(StageStyle.UNDECORATED); stage.initStyle(StageStyle.TRANSPARENT); stage.setTitle("UDEDesktop"); stage.setMinWidth(300); stage.setMinHeight(300); stage.show(); stage.toBack(); }
@Override public void start(Stage stage) { App.stage = stage; try { Parent root = FXMLLoader.load(App.class.getResource("/ui/Main.fxml")); Scene scene = new Scene(root); scene.getStylesheets().add(getClass().getResource("/style.css").toExternalForm()); stage.setTitle("OSRS Data To 317 Converter"); stage.centerOnScreen(); stage.setResizable(false); stage.sizeToScene(); stage.initStyle(StageStyle.UNDECORATED); stage.setScene(scene); stage.getIcons().add(new Image(App.class.getResourceAsStream("/icons/icon.png"))); stage.show(); } catch(Exception e) { e.printStackTrace(); } }
@Override public void start(Stage stage) throws Exception { URL location = getClass().getResource("MainFXMLDocument.fxml"); Parent root = FXMLLoader.load(location); root.setOnMouseDragged(e -> this.dragStage(e, stage)); root.setOnMouseMoved(e -> this.calculateGap(e, stage)); Scene scene = new Scene(root, Color.TRANSPARENT); scene.getStylesheets().add("/com/shekkar/xpanderfx/mainStyler.css"); stage.setScene(scene); stage.setAlwaysOnTop(true); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
@FXML private void btnAboutAction() { try { FXMLLoader loader = new FXMLLoader(MainDisplay.class.getResource("/fxml/AboutDialog.fxml")); Parent root = loader.load(); Scene scene = new Scene(root); Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.initStyle(StageStyle.UNDECORATED); stage.setScene(scene); stage.show(); } catch(IOException e) { e.printStackTrace(); } }
void Exe(int i) { if(i==1) { warnmesse="プレイ開始から5分経過しました\n混雑している場合は次の人に\n交代してください"; fontsize=25; }else if(i==2) { warnmesse="プレイ開始から10分経過しました\n混雑している場合は次の人に\n交代してください"; fontsize=25; }else if(i==-1) { warnmesse="user timer is reset"; fontsize=35; } final Stage primaryStage = new Stage(StageStyle.TRANSPARENT); primaryStage.initModality(Modality.NONE); final StackPane root = new StackPane(); final Scene scene = new Scene(root, 350, 140); scene.setFill(null); final Label label = new Label(warnmesse); label.setFont(new Font("Arial", fontsize)); BorderPane borderPane = new BorderPane(); borderPane.setCenter(label); borderPane.setStyle("-fx-background-radius: 10;-fx-background-color: rgba(0,0,0,0.3);"); root.getChildren().add(borderPane); final Rectangle2D d = Screen.getPrimary().getVisualBounds(); primaryStage.setScene(scene); primaryStage.setAlwaysOnTop(true); primaryStage.setX(d.getWidth()-350); primaryStage.setY(d.getHeight()-300); primaryStage.show(); final Timeline timer = new Timeline(new KeyFrame(Duration.seconds(CLOSE_SECONDS), (ActionEvent event) -> primaryStage.close())); timer.setCycleCount(Timeline.INDEFINITE); timer.play(); }
public static Stage getStage(Window owner) { Stage stage = new Stage(); ResourceBundle resources = ResourceBundle.getBundle("fxml/i18n/klc"); URL location = ExternalMonitor.class.getResource("/fxml/ExternalMonitor.fxml"); FXMLLoader loader = new FXMLLoader(location, resources); try { loader.load(); } catch (IOException e) { throw new RuntimeException(e); } stage.setTitle("Server Monitor"); stage.initModality(Modality.NONE); stage.initStyle(StageStyle.UTILITY); stage.initOwner(owner); stage.setScene(new Scene(loader.getRoot())); return stage; }
public static void alwaysInTop(Alert alert) { try{ DialogPane root = alert.getDialogPane(); Stage dialogStage = new Stage(StageStyle.UTILITY); for (ButtonType buttonType : root.getButtonTypes()) { ButtonBase button = (ButtonBase) root.lookupButton(buttonType); button.setOnAction(evt -> { root.setUserData(buttonType); dialogStage.close(); }); } root.getScene().setRoot(new Group()); Scene scene = new Scene(root); dialogStage.setScene(scene); dialogStage.initModality(Modality.APPLICATION_MODAL); dialogStage.setAlwaysOnTop(true); dialogStage.setResizable(false); dialogStage.showAndWait(); }catch(Exception e){ } // Optional<ButtonType> result = Optional.ofNullable((ButtonType) root.getUserData()); }
private void showInDialog(javafx.event.ActionEvent event) { //("SpecificationTableView.SpecificationTableView"); Stage s = new Stage(StageStyle.DECORATED); s.setTitle(getText()); s.initModality(Modality.APPLICATION_MODAL); s.setMinHeight(640); s.setMinHeight(480); s.setFullScreen(true); //s.setMaximized(true); //TableView<HybridRow> newView = new TableView<>(tableView.getItems()); setContent(new Label("opened externally")); BorderPane root = new BorderPane(tableView); ButtonBar bb = new ButtonBar(); root.setTop(bb); s.setScene(new Scene(root)); Button yesButton = new Button("Close"); ButtonBar.setButtonData(yesButton, ButtonBar.ButtonData.CANCEL_CLOSE); bb.getButtons().addAll(yesButton); yesButton.setOnAction(e -> s.hide()); s.showAndWait(); setContent(tableView); }
private static Stage buildWindow (String title) { tempStage = new Stage(); tempStage.initStyle(StageStyle.UTILITY); // Einfaches Fenster // ohne 'minimiere' // und 'maximiere' // Buttons tempStage.setResizable(false); // Verbiete �nderung // der Gr�sse tempStage.initModality(Modality.APPLICATION_MODAL); // Blockiere alle // anderen // Fenster tempStage.setTitle(title); // Setze Titel return tempStage; }
private void createModal(String fxmlRes) throws IOException{ Stage modalLogin = new Stage(); Parent root = FXMLLoader.load(getClass().getResource("/fxml/"+fxmlRes)); Scene scene = new Scene(root); scene.getStylesheets().add("/styles/Styles.css"); modalLogin.setScene(scene); modalLogin.initStyle(StageStyle.UNDECORATED); modalLogin.initOwner(login_btn.getScene().getWindow()); modalLogin.initModality(Modality.APPLICATION_MODAL); modalLogin.showAndWait(); if(toggle) { this.toggleControls(); HomeController.refreshMySong(); } toggle = false; }
/** * Create instance of {@link ProgressBarView}. */ public ProgressBarView() { try { final Stage newStage = new Stage(); newStage.setResizable(false); final URL resource = getClass().getResource(PROGRESS_BAR_VIEW); fxmlLoader = new FXMLLoader(resource); final Stage primaryStage = Hygene.getInstance().getPrimaryStage(); newStage.initOwner(primaryStage); newStage.initStyle(StageStyle.UTILITY); newStage.initModality(Modality.APPLICATION_MODAL); final double centerXPosition = primaryStage.getX() + primaryStage.getWidth() / 2; final double centerYPosition = primaryStage.getY() + primaryStage.getHeight() / 2; newStage.setOnShowing(event -> newStage.hide()); newStage.setOnShown(event -> { newStage.setX(centerXPosition - newStage.getWidth() / 2); newStage.setY(centerYPosition - newStage.getHeight() / 2); newStage.show(); }); setStage(newStage); } catch (final UIInitialisationException e) { LOGGER.error("Progress bar view could not be loaded.", e); } }
@Override public void start(final Stage primaryStage) throws IOException, UIInitialisationException { stage = primaryStage; primaryStage.setTitle(Hygene.TITLE); primaryStage.initStyle(StageStyle.UNDECORATED); progress = new ProgressBar(); final URL resource = getClass().getResource(PRELOADER_VIEW); final Parent root = FXMLLoader.load(resource); if (root == null) { throw new UIInitialisationException("Root of Preloader could not be found."); } final Scene rootScene = new Scene(root); primaryStage.setScene(rootScene); primaryStage.show(); }
@Override public void start(Stage stage) { scene = new Scene(new AppFrame(stage)); scene.getStylesheets().add("skins/Goliath-Magma.css"); stage.setScene(scene); stage.setTitle("Goliath Overclocking Utility V1.0 Alpha"); stage.initStyle(StageStyle.UNDECORATED); stage.setResizable(false); stage.setHeight(368); stage.setWidth(750); stage.show(); }
@FXML private void loadArchiveEditor() { try { FXMLLoader loader = new FXMLLoader(App.class.getResource("/ArchiveUI.fxml")); Parent root = (Parent) loader.load(); ArchiveController controller = (ArchiveController) loader.getController(); Stage stage = new Stage(); controller.setStage(stage); stage.setTitle("Archive Editor"); Scene scene = new Scene(root); scene.getStylesheets().add(App.class.getResource("/style.css").toExternalForm()); stage.getIcons().add(new Image(getClass().getResourceAsStream("/icons/app_icon_128.png"))); stage.setScene(scene); stage.initStyle(StageStyle.TRANSPARENT); stage.setResizable(false); stage.centerOnScreen(); stage.setTitle("Archive Editor"); stage.show(); } catch (IOException e) { e.printStackTrace(); } }
@Override public void start(Stage stage) { App.stage = stage; try { FXMLLoader loader = new FXMLLoader(App.class.getResource("/StoreUI.fxml")); Parent root = (Parent)loader.load(); StoreController controller = (StoreController)loader.getController(); controller.setStage(stage); Scene scene = new Scene(root); App.scene = scene; scene.getStylesheets().add(App.class.getResource("/style.css").toExternalForm()); stage.setScene(scene); stage.getIcons().add(new Image(getClass().getResourceAsStream("/icons/app_icon_128.png"))); stage.initStyle(StageStyle.TRANSPARENT); stage.setResizable(false); stage.centerOnScreen(); stage.setTitle("RS2 Asset Manager"); stage.show(); } catch (Exception e) { e.printStackTrace(); } }
public SettingsWindow(Stage parent) throws IOException { super(StageStyle.UNDECORATED); prefs = Preferences.userNodeForPackage(App.class); // Load root layout from fxml file. FXMLLoader loader = new FXMLLoader(getClass().getResource("fxml/settings_menu.fxml")); loader.setController(this); this.initModality(Modality.WINDOW_MODAL); this.initOwner(parent); this.setAlwaysOnTop(true); TabPane layout = loader.load(); Scene scene2 = new Scene(layout); this.setScene(scene2); this.setTitle("LMSGrabber Settings"); min_delay_slider.setValue(prefs.getDouble("min_delay", 1.0)); max_delay_slider.setValue(prefs.getDouble("max_delay", 3.0)); input_proxy.setText(prefs.get("proxy", "")); multithreaded_check.setSelected(prefs.getBoolean("multithreaded", true)); }
/** * Builds the window and add events. * @throws IOException */ public NewTaskWindow() throws IOException { super(); FXMLLoader fxmlLoader = new FXMLLoader( getClass().getResource("/FXML/newTask.fxml")); Parent root = (Parent) fxmlLoader.load(); taskController = (NewTaskController) fxmlLoader.getController(); taskController.applyGUIMods(); Scene scene = new Scene(root); scene.setFill(javafx.scene.paint.Color.TRANSPARENT); setScene(scene); setTitle("Add a task"); setResizable(false); initStyle(StageStyle.TRANSPARENT); this.wantsToAdd = false; //After pressing 'Enter', closes this window (which returns the value) scene.setOnKeyPressed((final KeyEvent keyEvent) -> { if (keyEvent.getCode() == KeyCode.ENTER) { this.wantsToAdd = true; this.close(); } else if (keyEvent.getCode() == KeyCode.ALT) { //Using alt key since tab doesn't work taskController.showDetails(); } else if (keyEvent.getCode() == KeyCode.ESCAPE) { this.close(); } }); //Not focusing the window means closing it focusedProperty().addListener((obs, wasFocused, isNowFocused) -> { if (!isNowFocused) { close(); } }); }
/** * Builds the window and add events. * @throws IOException */ public NewTaskListWindow() throws IOException { super(); FXMLLoader fxmlLoader = new FXMLLoader( getClass().getResource("/FXML/newTaskList.fxml")); Parent root = (Parent) fxmlLoader.load(); taskListController = (NewTaskListController) fxmlLoader.getController(); Scene scene = new Scene(root); setScene(scene); setResizable(false); initStyle(StageStyle.TRANSPARENT); this.wantsToAdd = false; //After pressing 'Enter', closes this window (which returns the value) scene.setOnKeyPressed((final KeyEvent keyEvent) -> { if (keyEvent.getCode() == KeyCode.ENTER) { this.wantsToAdd = true; this.close(); } else if (keyEvent.getCode() == KeyCode.ESCAPE) { this.close(); } }); //Not focusing the window means closing it focusedProperty().addListener((obs, wasFocused, isNowFocused) -> { if (!isNowFocused) { close(); } }); }
/** * Builds the window and add events. * @param oldTask Task to use. * @throws IOException */ public ModifyTaskWindow(Task oldTask) throws IOException { super(); FXMLLoader fxmlLoader = new FXMLLoader( getClass().getResource("/fxml/modifyTask.fxml")); Parent root = (Parent) fxmlLoader.load(); taskController = (ModifyTaskController) fxmlLoader.getController(); Scene scene = new Scene(root); setScene(scene); setResizable(false); initStyle(StageStyle.TRANSPARENT); taskController.fillOldTaskInfos(oldTask); //After pressing 'Enter', closes this window (which returns the value) scene.setOnKeyPressed((final KeyEvent keyEvent) -> { if (null != keyEvent.getCode()) switch (keyEvent.getCode()) { case ENTER: this.wantsToAdd = true; this.close(); break; case ESCAPE: this.close(); break; default: break; } }); //Not focusing the window means closing it focusedProperty().addListener((obs, wasFocused, isNowFocused) -> { if (!isNowFocused) { close(); } }); }
private void create(){ mStage = new Stage(); mStage.initModality(Modality.APPLICATION_MODAL); mStage.initOwner(null); mStage.initStyle(StageStyle.TRANSPARENT); mStage.setResizable(false); viewTuple = createContent(); if(viewTuple.getView() instanceof BaseView){ BaseView view = (BaseView) viewTuple.getView(); view.onDialogSet(this); root = (Pane) viewTuple.getRoot(); alignCenter(root.getPrefWidth(), root.getPrefHeight()); if(isDragable) dragDialogAbleNode(root); }else{ try { throw new Exception("your view is not a BaseView!"); } catch (Exception e) { e.printStackTrace(); } } mScene = new Scene(viewTuple.getRoot()); // mScene.getStylesheets().setAll(TestinStage.getInstance().getStylesheet()); mStage.setScene(mScene); }
@Override public void start(final Stage primaryStage) throws Exception { this.preloaderStage = primaryStage; final ImageView splash = new ImageView(new Image(Constant.IMG_DIR + "banner.png")); this.loadProgressPhase = new JFXProgressBar(); this.loadProgressPhase.setPrefWidth(Constant.SPLASH_WIDTH); this.splashLayout = new VBox(); this.splashLayout.getChildren().addAll(splash, this.loadProgressPhase); this.splashLayout.setStyle("-fx-padding: 5; " + "-fx-background-color: gainsboro; " + "-fx-border-width:2; " + "-fx-border-color: " + "linear-gradient(" + "to bottom, " + "MediumSeaGreen, " + "derive(MediumSeaGreen, 50%)" + ");"); this.splashLayout.setEffect(new DropShadow()); final Scene splashScene = new Scene(this.splashLayout, Color.TRANSPARENT); final Rectangle2D bounds = Screen.getPrimary().getBounds(); primaryStage.setScene(splashScene); primaryStage.setX(bounds.getMinX() + bounds.getWidth() / 2 - Constant.SPLASH_WIDTH / 2); primaryStage.setY(bounds.getMinY() + bounds.getHeight() / 2 - Constant.SPLASH_HEIGHT / 2); primaryStage.getIcons().add(new Image(Constant.IMG_DIR + "icon.png")); primaryStage.setTitle(Constant.APP_NAME); primaryStage.initStyle(StageStyle.UNDECORATED); primaryStage.setAlwaysOnTop(true); primaryStage.show(); }
@Override public void start(final Stage primaryStage) throws Exception { MineIDE.primaryStage = new Stage(StageStyle.DECORATED); MineIDE.primaryStage.getIcons().add(new Image(Constant.IMG_DIR + "icon.png")); MineIDE.primaryStage.setTitle(Constant.APP_NAME); // stage.setTitle(Gui.mineIdeInfo.getAppName() + " v" + // Gui.mineIdeInfo.getAppVersion() + " " + "Forge " // + Gui.mineIdeInfo.getForgeVersion()); final GuiMain main = GuiMain.getInstance(); main.init(); main.setOldPreferences(); // MineIDE.primaryStage.setMaximized(true); main.show(MineIDE.primaryStage); }
public DataImportDialog(Window owner, FinancialMarket fm, TatConfig config) { super(); this.fm = fm; this.config = config; setResizable(false); initStyle(StageStyle.DECORATED); initOwner(owner); setTitle("Financial Market Import"); initModality(Modality.APPLICATION_MODAL); Image appIcon = new Image("icon/IMPORT_MARKET_DATA.png"); getIcons().add(appIcon); root = new Group(); Scene scene = new Scene(root, 500, 440, Color.WHITE); ImagePattern pattern = new ImagePattern(new Image("icon/bk5.jpg")); scene.setFill(pattern); setScene(scene); initGui(); //Add listener to exit when press Esc key addEventHandler(KeyEvent.KEY_PRESSED, (KeyEvent event) -> { if (KeyCode.ESCAPE == event.getCode()) { DataImportDialog.this.close(); } if (KeyCode.ENTER == event.getCode()) { doImport(); } }); setX(owner.getX() + Math.abs(owner.getWidth() - scene.getWidth()) / 2.0); setY(owner.getY() + Math.abs(owner.getHeight() - scene.getHeight()) / 2.0); }
private Dialog getPayProgressDialog() { try { FXMLLoader loader = new FXMLLoader( getClass().getResource("/View/PayProgress.fxml") ); Parent root = loader.load(); dialog = new Dialog(); dialog.setResizable(false); dialog.setDialogPane((DialogPane) root); dialog.initOwner(owner); dialog.initModality(Modality.WINDOW_MODAL); dialog.initStyle(StageStyle.UTILITY); } catch (IOException e) { System.out.println("Unable to load dialog FXML"); e.printStackTrace(); } return dialog; }
@FXML private void btnDeleteAction() { try { FXMLLoader loader = new FXMLLoader(MainDisplay.class.getResource("/fxml/DeleteResultDialog.fxml")); Parent root = loader.load(); Scene scene = new Scene(root); Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.initStyle(StageStyle.UNDECORATED); stage.setScene(scene); stage.show(); Node node = scene.lookup("#txtArea"); if(node instanceof TextArea) { TextArea textArea = (TextArea)node; DeleteTask task = new DeleteTask(dataContainer); textArea.textProperty().bind(task.valueProperty()); Thread th = new Thread(task); th.setDaemon(true); th.start(); } else throw new IOException("Unable to find \"TextArea\" node"); } catch(IOException e) { e.printStackTrace(); } }
@FXML private void btnMapDevicesAction() { try { FXMLLoader loader = new FXMLLoader(MainDisplay.class.getResource("/fxml/MapDevicesDialog.fxml")); Parent root = loader.load(); Scene scene = new Scene(root); Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.initStyle(StageStyle.UNDECORATED); stage.setScene(scene); stage.show(); Node node = scene.lookup("#tblMapDevice"); if(node instanceof TableView) { TableView<Pair<String, String>> table = (TableView)node; ArrayList<Pair<String, String>> pairList = new ArrayList<>(); dataContainer.getDeviceMap().entrySet().forEach(entry -> pairList.add(new Pair<String, String>(entry.getKey(), entry.getValue()))); ObservableList<Pair<String, String>> tableModel = FXCollections.<Pair<String, String>> observableArrayList(pairList); table.setItems(tableModel); } } catch(IOException e) { e.printStackTrace(); } }
public void joinNow(ActionEvent actionEvent) { try { FXMLLoader fxmlLoader2 = new FXMLLoader(getClass().getResource("../../Resources/Layouts/register_stage.fxml")); Parent root2 = (Parent) fxmlLoader2.load(); Stage stage2 = new Stage(); stage2.setScene(new Scene(root2)); stage2.setResizable(false); stage2.initModality(Modality.WINDOW_MODAL); stage2.initOwner(ApplicationLauncher.primaryStage); stage2.initStyle(StageStyle.UNDECORATED); stage2.showAndWait(); } catch (Exception e1) { } }
private BaseDialog create() { mStage = new Stage(); mStage.initModality(Modality.WINDOW_MODAL); mStage.initOwner(getOwner()); mStage.initStyle(StageStyle.DECORATED); mStage.setResizable(false); viewTuple = createContent(); BaseView view = null; if(viewTuple.getView() instanceof BaseView){ view = (BaseView) viewTuple.getView(); view.onDialogSet(this); root = (Pane) viewTuple.getRoot(); alignCenter(root.getPrefWidth(), root.getPrefHeight()); if(isDragable) dragDialogAbleNode(root); } else { try { throw new Exception("your view is not a BaseView!"); } catch (Exception e) { e.printStackTrace(); } } mScene = new Scene(viewTuple.getRoot()); // mScene.getStylesheets().setAll(TestinStage.getInstance().getStylesheet()); mStage.setScene(mScene); mStage.setTitle(view.getTitle()); return this; }
public DataUpdateDialog(TatMain app, Window owner, FinancialMarket fm, TatConfig config, boolean bUpdateMode) { super(); this.bUpdateMode = bUpdateMode; this.fm = fm; this.config = config; setResizable(false); initStyle(StageStyle.DECORATED); initOwner(owner); application = app; if (bUpdateMode == true){ setTitle("View & update market data"); } else { setTitle("Select a market data"); } initModality(Modality.APPLICATION_MODAL); Image appIcon = new Image("icon/UPDATE_MARKET_DATA.png"); getIcons().add(appIcon); root = new Group(); Scene scene = new Scene(root, 700, 620, Color.WHITE); ImagePattern pattern = new ImagePattern(new Image("icon/bk5.jpg")); scene.setFill(pattern); setScene(scene); marketDataTreeView = new MarketDataTreeViewNode(application, fm, config, this.bUpdateMode); initGui(); //Add listener to exit when press Esc key addEventHandler(KeyEvent.KEY_PRESSED, (KeyEvent event) -> { if (KeyCode.ESCAPE == event.getCode()) { DataUpdateDialog.this.close(); } }); setX(owner.getX() + Math.abs(owner.getWidth() - scene.getWidth()) / 2.0); setY(owner.getY() + Math.abs(owner.getHeight() - scene.getHeight()) / 2.0); }
private void showMasterDetailInWindow(final Stage stage, final Database database, final MasterDetailViewFeatures features) throws JAXBException, IOException { final Parent viewRoot = ViewFactory.createMasterDetailView(database, features); final Rectangle clip = new Rectangle(); clip.setArcHeight(18); clip.setArcWidth(18); clip.widthProperty().bind(stage.widthProperty()); clip.heightProperty().bind(stage.heightProperty()); //TODO: Only clipping or PerspectiveCamera is working... :( features.customWindowClipProperty().addListener((obs, oldVal, newVal) -> { if (newVal) { viewRoot.setClip(clip); } else { viewRoot.setClip(null); } }); final Scene scene = new Scene(viewRoot); features.useCssProperty().addListener((obs, oldVal, newVal) -> { updateStylesheets(scene, newVal); }); updateStylesheets(scene, features.isUseCss()); scene.setFill(Color.TRANSPARENT); scene.setCamera(new PerspectiveCamera()); if (features.isCustomWindowUI()) { stage.initStyle(StageStyle.TRANSPARENT); } stage.setTitle("Movie Database"); stage.setScene(scene); stage.setWidth(1100); stage.setHeight(720); stage.centerOnScreen(); stage.show(); final FeaturesDialog featuresDialog = new FeaturesDialog(stage); featuresDialog.addFeature(new Feature("Layout & Style", "demo2-css", features.useCssProperty())); featuresDialog.addFeature(new Feature("Image Background", "demo2-image-background",features.movieBackgroundProperty())); featuresDialog.addFeature(new Feature("List Animation", "demo2-list-animation",features.listAnimationProperty())); featuresDialog.addFeature(new Feature("List Shadow", "demo2-list-shadow",features.listShadowProperty())); // featuresDialog.addFeature(new Feature("List Cache", "demo2-list-cache",features.listCacheProperty())); featuresDialog.addFeature(new Feature("Poster Transform", "demo2-poster-transform",features.posterTransformProperty())); featuresDialog.addFeature(new Feature("Custom Window UI", "demo2-custom-window-ui",features.customWindowUIProperty())); featuresDialog.addFeature(new Feature("Custom Window Clip", "demo2-custom-window-clip", features.customWindowClipProperty())); featuresDialog.show(); }
/** Show progress bar */ public void showProgressBar() { Platform.runLater(() -> { try { Parent toProgressBar = FXMLLoader.load(getClass().getResource("/view/ProgressBar.fxml")); Scene scene = new Scene(toProgressBar); scene.getStylesheets().add("resources/myprogressbar.css"); progressBarStage = new Stage(); int progressBarIndex = ProgressBarScene.getIndex(); progressBarStage.initStyle(StageStyle.TRANSPARENT); progressBarStage.setScene(scene); progressBarStage.getIcons().add(new javafx.scene.image.Image("resources/Logo.png")); progressBarStage.initModality(Modality.WINDOW_MODAL); progressBarStage.show(); progressBarStage.setX(Screen.getPrimary().getBounds().getWidth() - progressBarStage.getWidth() - 10); progressBarStage.setY(Screen.getPrimary().getBounds().getHeight() - progressBarStage.getHeight() - 50 - progressBarIndex * 55); progressBarStageArray[progressBarIndex] = progressBarStage; } catch (Exception e) { e.printStackTrace(); } }); }
@Override public void start(Stage stage) throws Exception { Platform.setImplicitExit(false); Injector.setConfigurationSource(config::getInjectionValue); Injector.setLogger(s -> LOG.info(s)); Injector.setModelOrService(Logger.class, LOG); Injector.setModelOrService(HueSenseConfig.class, config); Injector.setModelOrService(DBManager.class, dbMan); Injector.setModelOrService(DataStore.class, store); Injector.setModelOrService(HueComm.class, hue); Injector.setModelOrService(LanComm.class, lan); Injector.setModelOrService(MailService.class, mailServ); ConnectingView connView = new ConnectingView(); Scene scene = new Scene(connView.getView()); scene.setFill(Color.WHITE); stage.setTitle("HueSense"); final String uri = Thread.currentThread().getContextClassLoader().getResource("global.css").toExternalForm(); scene.getStylesheets().add(uri); stage.initStyle(StageStyle.TRANSPARENT); stage.setScene(scene); stage.setAlwaysOnTop(true); stage.setResizable(false); stage.centerOnScreen(); UIUtils.setIcon(stage); stage.show(); hue.startConnecting(); }
public void print() { Printer printer = Printer.getDefaultPrinter(); Stage stage = new Stage(StageStyle.DECORATED); PrinterJob job = PrinterJob.createPrinterJob(printer); if (job != null) { boolean showDialog = job.showPageSetupDialog(stage); if (showDialog) { myPrint.setScaleX(0.46); myPrint.setScaleY(0.46); myPrint.setTranslateX(-252); myPrint.setTranslateY(-110); boolean success = job.printPage(myPrint); if (success) { job.endJob(); } myPrint.setTranslateX(0); myPrint.setTranslateY(0); myPrint.setScaleX(1.0); myPrint.setScaleY(1.0); } } }
public void initialize(String hostname, String serviceName, String user, SpeedGuideConsumer consumer) { m_connection.setConnection(hostname, serviceName, user); m_consumer = consumer; // Define the main viewing scene, Scene scene = new Scene(layout, layout.getPrefWidth(), layout.getPrefHeight()); // Assign to our main stage and show the application to the end user m_dialog.setTitle("Elektron Connection Values"); m_dialog.setScene(scene); m_dialog.initModality(Modality.APPLICATION_MODAL); m_dialog.initStyle(StageStyle.UTILITY); m_dialog.setResizable(false); connect.disableProperty().bind(Bindings.isEmpty(host.textProperty()).or(Bindings.isEmpty(service.textProperty()))); }
public static void showAlertFromError(Throwable e) { Platform.runLater(() -> { Alert alert = new Alert(Alert.AlertType.ERROR); alert.initStyle(StageStyle.UTILITY); alert.setTitle("Error"); alert.setContentText("An error has occured, submit an issue with the stack " + "trace if you need help."); alert.setHeaderText(null); TextArea textArea = new TextArea(throwableToString(e)); textArea.setEditable(false); textArea.setMaxWidth(Double.MAX_VALUE); textArea.setMaxHeight(Double.MAX_VALUE); GridPane.setVgrow(textArea, Priority.ALWAYS); GridPane.setHgrow(textArea, Priority.ALWAYS); GridPane expContent = new GridPane(); expContent.setMaxWidth(Double.MAX_VALUE); expContent.add(textArea, 0, 1); alert.getDialogPane().setExpandableContent(expContent); alert.getDialogPane().getStylesheets().add(Form.class.getResource(CSS_FILE).toExternalForm()); alert.showAndWait(); }); }