Java Code Examples for javafx.stage.Stage#setResizable()

The following examples show how to use javafx.stage.Stage#setResizable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StudentDetailController.java    From Hostel-Management-System with MIT License 6 votes vote down vote up
@FXML
private void viewPayBillAction(ActionEvent event)
{
    MainProgramSceneController.mainTopAnchorPane.setEffect(new BoxBlur());
    billStage = new Stage();
    billStage.setOnCloseRequest(new EventHandler<WindowEvent>()
    {
        @Override
        public void handle(WindowEvent t)
        {
            MainProgramSceneController.mainTopAnchorPane.effectProperty().setValue(null);
        }
    });
    billStage.setTitle("View And Pay Due Bills");
    billStage.initModality(Modality.APPLICATION_MODAL);
    billStage.initStyle(StageStyle.UTILITY);
    billStage.setResizable(false);
    try
    {
        Parent passwordParent = FXMLLoader.load(getClass().getResource("viewPayBill.fxml"));
        billStage.setScene(new Scene(passwordParent));
        billStage.show();
    } catch (IOException ex)
    {
    }
}
 
Example 2
Source File: ADCStandaloneProgressWindow.java    From arma-dialog-creator with MIT License 6 votes vote down vote up
public ADCStandaloneProgressWindow(@NotNull Stage stage) {
	this.stage = stage;

	stage.getIcons().add(new Image("/com/armadialogcreator/pwindow/app.png"));

	root = new VBox(5);
	stage.setScene(new Scene(new StackPane(root)));
	stage.setResizable(false);

	root.setPrefSize(720, 360);
	root.setAlignment(Pos.CENTER);
	root.setPadding(new Insets(10));

	root.getChildren().add(new ImageView("/com/armadialogcreator/pwindow/adc_title.png"));

	progressBar.setMaxWidth(Double.MAX_VALUE);
	root.getChildren().add(progressBar);
	root.getChildren().add(lblStatus);
	lblError.setTextFill(Color.RED);
	root.getChildren().add(lblError);
}
 
Example 3
Source File: Toast.java    From Animu-Downloaderu with MIT License 6 votes vote down vote up
public static Toast makeToast(Window window, String toastMsg, int toastDelay, int fadeInDelay, int fadeOutDelay) {
	Stage toastStage = new Stage();
	toastStage.initOwner(window);
	toastStage.setResizable(false);
	toastStage.initStyle(StageStyle.TRANSPARENT);
	Text text = new Text(toastMsg);
	text.setFont(Font.font("Verdana", FontWeight.BOLD, 20));
	text.setFill(Color.RED);

	StackPane root = new StackPane(text);
	root.setStyle("-fx-background-radius: 20; -fx-background-color: rgba(0, 0, 0, 0.7); -fx-padding: 20px;");
	root.setOpacity(0);

	Scene scene = new Scene(root);
	scene.setFill(Color.TRANSPARENT);
	toastStage.setScene(scene);
	return new Toast(toastStage, toastDelay, fadeInDelay, fadeOutDelay);
}
 
Example 4
Source File: NotificationView.java    From Maus with GNU General Public License v3.0 6 votes vote down vote up
public static void openNotification(String text) {
    Stage stage = new Stage();
    stage.setWidth(300);
    stage.setHeight(125);
    Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
    NotificationView notificationView = new NotificationView();
    stage.setScene(new Scene(notificationView.getNotificationView(), 300, 125));
    stage.setResizable(false);
    stage.setAlwaysOnTop(true);
    stage.setX(primaryScreenBounds.getMinX() + primaryScreenBounds.getWidth() - 300);
    stage.setY(primaryScreenBounds.getMinY() + primaryScreenBounds.getHeight() - 125);
    stage.initStyle(StageStyle.UNDECORATED);
    notificationView.getNotificationText().setWrapText(true);
    notificationView.getNotificationText().setAlignment(Pos.CENTER);
    notificationView.getNotificationText().setPadding(new Insets(0, 5, 0, 20));
    notificationView.getNotificationText().setText(text);
    stage.show();
    PauseTransition delay = new PauseTransition(Duration.seconds(5));
    delay.setOnFinished(event -> stage.close());
    delay.play();
}
 
Example 5
Source File: GUI.java    From density-converter with Apache License 2.0 5 votes vote down vote up
public static GUIController setup(Stage primaryStage, IPreferenceStore store, Dimension screenSize) throws IOException {
    primaryStage.setTitle("Density Converter");

    ResourceBundle bundle = ResourceBundle.getBundle("bundles.strings", Locale.getDefault());

    FXMLLoader loader = new FXMLLoader(GUI.class.getClassLoader().getResource("main.fxml"));
    loader.setResources(bundle);
    Parent root = loader.load();
    GUIController controller = loader.getController();
    controller.onCreate(primaryStage, store, bundle);

    if (screenSize.getHeight() <= 768) {
        MIN_HEIGHT = 740;
    }

    Scene scene = new Scene(root, 600, MIN_HEIGHT);
    primaryStage.setScene(scene);
    primaryStage.setResizable(true);
    primaryStage.setMinWidth(400);
    primaryStage.setMinHeight(500);
    primaryStage.getIcons().add(new Image("img/density_converter_icon_16.png"));
    primaryStage.getIcons().add(new Image("img/density_converter_icon_24.png"));
    primaryStage.getIcons().add(new Image("img/density_converter_icon_48.png"));
    primaryStage.getIcons().add(new Image("img/density_converter_icon_64.png"));
    primaryStage.getIcons().add(new Image("img/density_converter_icon_128.png"));
    primaryStage.getIcons().add(new Image("img/density_converter_icon_256.png"));

    return controller;
}
 
Example 6
Source File: OpenLabeler.java    From OpenLabeler with Apache License 2.0 5 votes vote down vote up
public static Stage createAboutStage(ResourceBundle bundle) {
    try {
        FXMLLoader loader = new FXMLLoader(OpenLabeler.class.getResource("/fxml/AboutPane.fxml"), bundle);
        Parent root = loader.load();

        Stage stage = new Stage();
        stage.setTitle(bundle.getString("app.name"));
        stage.focusedProperty().addListener((observable, oldValue, newValue) -> {
            if (!newValue) {
                stage.close();
            }
        });
        stage.initStyle(StageStyle.UNDECORATED);
        stage.setResizable(false);
        stage.setScene(new Scene(root));
        return stage;
    }
    catch (Exception ex) {
        LOG.log(Level.WARNING, "Failed to load ICNS file", ex);
    }

    return null;
}
 
Example 7
Source File: AbstractZestExample.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void start(final Stage primaryStage) throws Exception {
	// create graph
	graph = createGraph();

	// configure application
	Injector injector = Guice.createInjector(createModule());
	domain = injector.getInstance(IDomain.class);
	viewer = domain.getAdapter(
			AdapterKey.get(IViewer.class, IDomain.CONTENT_VIEWER_ROLE));
	primaryStage.setScene(createScene(viewer));

	primaryStage.setResizable(true);
	primaryStage.setWidth(getStageWidth());
	primaryStage.setHeight(getStageHeight());
	primaryStage.setTitle(title);
	primaryStage.show();

	// activate domain only after viewers have been hooked
	domain.activate();

	// set contents in the JavaFX application thread because it alters the
	// scene graph
	Platform.runLater(new Runnable() {
		@Override
		public void run() {
			viewer.getContents().setAll(Collections.singletonList(graph));
		}
	});
}
 
Example 8
Source File: Main.java    From javafx-TKMapEditor with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void start(Stage primaryStage) {
	try {
		BorderPane root = (BorderPane)FXMLLoader.load(getClass().getResource("MainLayout.fxml"));
		Scene scene = new Scene(root,1024,640);
		scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
		primaryStage.setScene(scene);
		primaryStage.setTitle("WiTKMapEditor V0.7.8.2018.4.26");
		primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("icon.png")));
		primaryStage.setResizable(false);
		primaryStage.show();
	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
Example 9
Source File: UIBaseTest.java    From trex-stateless-gui with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
    TrexApp.setPrimaryStage(stage);
    AnchorPane page = (AnchorPane) FXMLLoader.load(getClass().getResource("/fxml/MainView.fxml"));
    Scene scene = new Scene(page);
    scene.getStylesheets().add(TrexApp.class.getResource("/styles/mainStyle.css").toExternalForm());
    stage.setScene(scene);
    stage.setTitle("TRex");
    stage.setResizable(true);
    stage.setMinWidth(1100);
    stage.setMinHeight(670);
    stage.show();
}
 
Example 10
Source File: Main.java    From ApkCustomizationTool with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    Parent root = FXMLLoader.load(getClass().getResource("fxml/main.fxml"));
    primaryStage.setTitle(TITLE);
    primaryStage.setScene(new Scene(root));
    primaryStage.initStyle(StageStyle.UNIFIED);
    primaryStage.setResizable(false);
    primaryStage.show();
    stage = primaryStage;
}
 
Example 11
Source File: AlarmApp.java    From FXTutorials with MIT License 5 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
    FXMLLoader loader = new FXMLLoader(getClass().getResource("ui.fxml"));

    AlarmController controller = new AlarmController(new AlarmModel());
    loader.setController(controller);

    stage.setScene(new Scene(loader.load()));
    stage.setOnCloseRequest(e -> controller.onExit());
    stage.setTitle("Alarm");
    stage.setResizable(false);
    stage.show();
}
 
Example 12
Source File: Main.java    From blobsaver with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void start(Stage primaryStage) throws IOException {
    Main.primaryStage = primaryStage;
    Parent root = FXMLLoader.load(getClass().getResource("blobsaver.fxml"));
    primaryStage.setTitle("blobsaver " + Main.appVersion);
    primaryStage.setScene(new Scene(root));
    primaryStage.getScene().getStylesheets().add(getClass().getResource("app.css").toExternalForm());
    if (!PlatformUtil.isMac()) {
        primaryStage.getIcons().clear();
        primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("blob_emoji.png")));
    }
    primaryStage.setResizable(false);
    Controller.afterStageShowing();
    Platform.setImplicitExit(false);
    showStage();
    if (appPrefs.getBoolean("Start background immediately", false)) {
        /* I have to show the stage then hide it again in Platform.runLater() otherwise
         * the needed initialization code won't run at the right time when starting the background
         * (for example, the macOS menu bar won't work properly if I don't do this)
         */
        Platform.runLater(() -> {
            hideStage();
            Background.startBackground(false);
        });
    }
    //if in background, hide; else quit
    primaryStage.setOnCloseRequest(event -> {
        event.consume();
        if (Background.inBackground) {
            hideStage();
        } else {
            Platform.exit();
        }
    });
    appPrefs.put("App version", appVersion);
}
 
Example 13
Source File: BaseController.java    From Vert.X-generator with MIT License 5 votes vote down vote up
/**
 * 加载一个页面
 * 
 * @param title
 *          页面标题
 * @param fxmlPage
 *          页面FXML路径
 * @param resize
 *          是否可以窗口最大化
 * @param cache
 *          是否换缓存
 * @return
 */
public BaseController loadFXMLPage(String title, FXMLPage fxmlPage, boolean resize, boolean cache) {
	SoftReference<? extends BaseController> parentNodeRef = cacheNodeMap.get(fxmlPage);
	if (cache && parentNodeRef != null) {
		return parentNodeRef.get();
	}
	URL skeletonResource = Thread.currentThread().getContextClassLoader().getResource(fxmlPage.getFxml());

	FXMLLoader loader = new FXMLLoader(skeletonResource);

	Parent loginNode;
	try {
		loginNode = loader.load();
		BaseController controller = loader.getController();
		dialogStage = new Stage();
		dialogStage.setTitle(title);
		dialogStage.getIcons().add(new Image("image/icon.png"));
		dialogStage.initModality(Modality.APPLICATION_MODAL);
		dialogStage.initOwner(getPrimaryStage());
		dialogStage.setScene(new Scene(loginNode));
		dialogStage.setMaximized(false);
		dialogStage.setResizable(resize);
		dialogStage.show();
		controller.setDialogStage(dialogStage);
		SoftReference<BaseController> softReference = new SoftReference<>(controller);
		cacheNodeMap.put(fxmlPage, softReference);
		return controller;
	} catch (IOException e) {
		AlertUtil.showErrorAlert(e.getMessage());
	}
	return null;

}
 
Example 14
Source File: MenuController.java    From zest-writer with GNU General Public License v3.0 5 votes vote down vote up
@FXML private void handleOpenButtonAction(ActionEvent event){
    FXMLLoader loader = new CustomFXMLLoader(MainApp.class.getResource("fxml/OpenContent.fxml"));

    Stage dialogStage = new CustomStage(loader, Configuration.getBundle().getString("ui.menu.dialog.content.open.title"));
    dialogStage.setResizable(false);
    OpenContent openContentDialog = loader.getController();
    openContentDialog.setMainApp(mainApp);
    openContentDialog.setOpenContentWindow(dialogStage);

    dialogStage.show();
}
 
Example 15
Source File: CodeGeneratorJFX.java    From Entitas-Java with MIT License 5 votes vote down vote up
@Override
public void start(Stage primaryStage) throws IOException {
    FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("EntitasGenerator.fxml"));
    Parent root = loader.load();
    primaryStage.setTitle("CodeGenerator");
    primaryStage.setScene(new Scene(root, 560, 575));
    primaryStage.setResizable(false);
    primaryStage.show();

    stage = primaryStage;

}
 
Example 16
Source File: AboutStageBuilder.java    From NSMenuFX with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public static AboutStageBuilder start(String title) {
  final Stage aboutStage = new Stage();
  aboutStage.setResizable(false);
  return new AboutStageBuilder(aboutStage).withTitle(title).withSize(300, 300);
}
 
Example 17
Source File: Main.java    From ApkToolPlus with Apache License 2.0 4 votes vote down vote up
@Override
    public void start(Stage stage) throws Exception{
        // 设置应用图标
        ViewUtils.setWindowIcon(stage, ClassUtils.getResourceAsURL("res/white_icon/white_icon_Plus.png"));
        // 无边框
        ViewUtils.setNoBroder(stage);
        // 设置标题
        stage.setTitle("ApkToolPlus");
        // 背景透明
        stage.initStyle(StageStyle.TRANSPARENT);
        // 设置透明度
        //stage.setOpacity(0.8);
        // 大小不可变
        stage.setResizable(false);

        // main ui
        StackPane root = new StackPane();
        AnchorPane layout = FXMLLoader.load(MainActivity.class.getResource("main.fxml"));
        layout.setBackground(Background.EMPTY);
        root.getChildren().add(layout);

        // 设置根节点
        Global.setRoot(root);

        Scene scene = new Scene(root, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT, Color.TRANSPARENT);
        stage.setScene(scene);

        // test
//        Loading loading = new Loading(ClassUtils.getResourceAsURL("res/gif/loading.gif"));
//        loading.setMessage("正在加载,请稍候...");
//        root.getChildren().add(loading);
//        loading.lauchTimeoutTimer(2000);

        // 在屏幕中间
        stage.centerOnScreen();

        // 设置拖拽事件
        ViewUtils.registerDragEvent(stage,root);

        stage.show();

        // 恢复上次打开页面
        Integer lastPageIndex = Integer.parseInt(Config.get(Config.kLastPageIndex, "0"));
        MainActivity.getInstance().pages.setCurrentPageIndex(lastPageIndex);
    }
 
Example 18
Source File: TimelineEvents.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 260,100));
    //create a circle with effect
    final Circle circle = new Circle(20,  Color.rgb(156,216,255));
    circle.setEffect(new Lighting());
    //create a text inside a circle
    final Text text = new Text (i.toString());
    text.setStroke(Color.BLACK);
    //create a layout for circle with text inside
    final StackPane stack = new StackPane();
    stack.getChildren().addAll(circle, text);
    stack.setLayoutX(30);
    stack.setLayoutY(30);

    //create a timeline for moving the circle

    timeline = new Timeline();
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can add a specific action when each frame is started. There are one or more frames during
    // executing one KeyFrame depending on set Interpolator.
    timer = new AnimationTimer() {
        @Override
        public void handle(long l) {
            text.setText(i.toString());
            i++;
        }

    };

    //create a keyValue with factory: scaling the circle 2times
    KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2);
    KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2);

    //create a keyFrame, the keyValue is reached at time 2s
    Duration duration = Duration.seconds(2);
    //one can add a specific action when the keyframe is reached
    EventHandler<ActionEvent> onFinished = new EventHandler<ActionEvent>() {
        public void handle(ActionEvent t) {
             stack.setTranslateX(java.lang.Math.random()*200);
             //reset counter
             i = 0;
        }
    };

    KeyFrame keyFrame = new KeyFrame(duration, onFinished , keyValueX, keyValueY);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    root.getChildren().add(stack);
}
 
Example 19
Source File: CheckListView.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
@Override
protected void initialize(Stage stage) {
    super.initialize(stage);
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setResizable(false);
}
 
Example 20
Source File: TopsoilWindow.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
public void loadTopsoilWindow(double x, double y) {

        Pane topsoilPlotUI = topsoilPlot.initializePlotPane();

        Scene topsoilPlotScene = new Scene(topsoilPlotUI, 900, 600);
                
        setScene(topsoilPlotScene);
        
        topsoilPlotWindow = new Stage(StageStyle.DECORATED);

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

    }