Java Code Examples for javafx.stage.StageStyle

The following are top voted examples for showing how to use javafx.stage.StageStyle. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: hygene   File: AboutView.java   View source code 9 votes vote down vote up
/**
 * 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();
        }
    });
}
 
Example 2
Project: primitivefxmvc   File: GenericView.java   View source code 9 votes vote down vote up
/**
 * 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;
}
 
Example 3
Project: rsam-gui   File: StoreController.java   View source code 8 votes vote down vote up
@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();
	}
}
 
Example 4
Project: CapsLock   File: OverLayWindow.java   View source code 8 votes vote down vote up
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();
}
 
Example 5
Project: Squid   File: TopsoilWindow.java   View source code 7 votes vote down vote up
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();

    }
 
Example 6
Project: MineIDE   File: MineIDEPreloader.java   View source code 7 votes vote down vote up
@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();

}
 
Example 7
Project: UDE   File: UDEDesktop.java   View source code 7 votes vote down vote up
@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();
}
 
Example 8
Project: osrs-data-converter   File: App.java   View source code 7 votes vote down vote up
@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();
	}
}
 
Example 9
Project: xpanderfx   File: XpanderFX.java   View source code 7 votes vote down vote up
@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();	
}
 
Example 10
Project: SnapDup   File: MainDisplay.java   View source code 7 votes vote down vote up
@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();
	}
}
 
Example 11
Project: gatepass   File: DailyGenerated.java   View source code 7 votes vote down vote up
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); 
               }
           }
}
 
Example 12
Project: gatepass   File: DailyGenerated.java   View source code 7 votes vote down vote up
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); 
               }
           }
}
 
Example 13
Project: ChessBot   File: UIUtils.java   View source code 7 votes vote down vote up
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());
    }
 
Example 14
Project: stvs   File: SpecificationTableView.java   View source code 7 votes vote down vote up
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);
}
 
Example 15
Project: Lernkartei_2017   File: Alert.java   View source code 6 votes vote down vote up
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;
}
 
Example 16
Project: Shield   File: HomeController.java   View source code 6 votes vote down vote up
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;
}
 
Example 17
Project: hygene   File: ProgressBarView.java   View source code 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example 18
Project: hygene   File: HygenePreloader.java   View source code 6 votes vote down vote up
@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();
}
 
Example 19
Project: Goliath-Overclocking-Utility-FX   File: GoliathOUFX.java   View source code 6 votes vote down vote up
@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();
}
 
Example 20
Project: rsam-gui   File: StoreController.java   View source code 6 votes vote down vote up
@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();
	}
}
 
Example 21
Project: rsam-gui   File: App.java   View source code 6 votes vote down vote up
@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();
	}
}
 
Example 22
Project: LMSGrabber   File: SettingsWindow.java   View source code 6 votes vote down vote up
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));
}
 
Example 23
Project: EMBER   File: NewTaskWindow.java   View source code 6 votes vote down vote up
/**
 * 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();
        }
    });
}
 
Example 24
Project: EMBER   File: NewTaskListWindow.java   View source code 6 votes vote down vote up
/**
 * 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();
        }
    });
}
 
Example 25
Project: EMBER   File: ModifyTaskWindow.java   View source code 6 votes vote down vote up
/**
 * 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();
        }
    });
}
 
Example 26
Project: easyMvvmFx   File: BaseDialog.java   View source code 6 votes vote down vote up
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);
    }
 
Example 27
Project: MineIDE   File: MineIDE.java   View source code 6 votes vote down vote up
@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);
}
 
Example 28
Project: TechnicalAnalysisTool   File: DataImportDialog.java   View source code 6 votes vote down vote up
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);
   }
 
Example 29
Project: CNU_TermProject_SoftwareEngineering   File: PaymentController.java   View source code 6 votes vote down vote up
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;
}
 
Example 30
Project: SnapDup   File: MainDisplay.java   View source code 6 votes vote down vote up
@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();
	}
}
 
Example 31
Project: SnapDup   File: MainDisplay.java   View source code 6 votes vote down vote up
@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();
	}
}
 
Example 32
Project: alchem   File: LoginController.java   View source code 6 votes vote down vote up
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) {
    }
}
 
Example 33
Project: javafx-qiniu-tinypng-client   File: BaseDialog.java   View source code 6 votes vote down vote up
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;
    }
 
Example 34
Project: TechnicalAnalysisTool   File: DataUpdateDialog.java   View source code 6 votes vote down vote up
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);
   }
 
Example 35
Project: ExtremeGuiMakeover   File: MovieApp.java   View source code 6 votes vote down vote up
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();
}
 
Example 36
Project: Clipcon-Client   File: MainScene.java   View source code 6 votes vote down vote up
/** 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();
		}
	});
}
 
Example 37
Project: HueSense   File: Launcher.java   View source code 6 votes vote down vote up
@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();

}
 
Example 38
Project: keyboard-light-composer   File: ExternalMonitor.java   View source code 6 votes vote down vote up
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;
	}
 
Example 39
Project: gatepass   File: MonthlyReports.java   View source code 6 votes vote down vote up
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); 
               }
           }
}
 
Example 40
Project: Example.EMA.Java.SpeedGuide   File: SpeedGuideConnection.java   View source code 6 votes vote down vote up
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())));
}