Article From:https://www.cnblogs.com/yanquebbuyan/p/9970798.html

1.StageClasses inherit from Windows classes and show () methods of Windows classes. Stage’s close () method actually calls hide () methods inherited from Windows classes. There is also a Windows setOpacity () methodSet transparency for Stage.

2.StageStyle settings

 1         Stage stage = new Stage(StageStyle.DECORATED);//There are no different default attributes
 2         Stage stage = new Stage(StageStyle.TRANSPARENT);//Stage transparency
 3         Stage stage = new Stage(StageStyle.UNDECORATED);//Still transparent, but slightly different from the above transparency
 4         Stage stage = new Stage(StageStyle.UNIFIED);//Edge color without focus
 5         Stage stage = new Stage(StageStyle.UTILITY);//No Minimization Button 6 
 7 
 8         //It can also be set as follows: 9         //Stage stage = new Stage();
10         //stage.initStyle(StageStyle.DECORATED);

3.StageModal settings: Stage mode has two attributes:Modality.WINDOW_MODALandModality.APPLICATION_MODAL

Modality.APPLICATION_MODAL:Setting the Stage of this mode to appear at the top of the form blocks the display of other forms.

            Stage stage2 = new Stage();
            stage2.setTitle("This is the second stage.);
   
            Stage stage3 = new Stage();
            stage3.setTitle("This is the third stage.);
    
            Stage stage4 = new Stage();
            stage4.setTitle("This is the fourth stage.);
            stage4..initModality(Modality.APPLICATION_MODAL);
            
           stage2.show();
           stage3.show();
           stage4.show();//Note: Stage 4 only works when it appears on other pages
/*
           stage4.show();
           stage2.show();
           stage3.show();//This is ineffective.*/

Modality.WINDOW_MODAL:The stage set to this mode will only block its owner window (through initowner () settings), but only if the window appears above its owner window.

 1            Stage stage2 = new Stage();
 2            stage2.setTitle("This is the second stage.);
 3    
 4             Stage stage3 = new Stage();
 5             stage3.setTitle("This is the third stage.);
 6     
 7             Stage stage4 = new Stage();
 8             stage4.setTitle("This is the fourth stage.);
 9             stage4.initOwner(stage2);
10            stage4..initModality(Modality.WINDOW_MODAL);
11   
12            stage2.show();
13            stage3.show();
14            stage4.show();//Similarly, stage 4 will not work until it appears on stage 2.

 Note: Stage (primarStage) introduced by the start () method cannot set modal properties, otherwise an exception will occur.

4. Other settings:

           primaryStage.setAlwaysOnTop(true);//Stage setting is not covered by other stages//        primaryStage.setResizable(false);//Can Stage Setting Be Stretched//        primaryStage.setFullScreen(true);//Set the stage to full screen mode, only when Scene is set in the stage will the effect appear.//        primaryStage.setFullScreenExitHint("Hello");//Setting the stage into full screen mode is the prompt, default is to press ESC key to exit the full screen//        primaryStage.setFullScreenExitKeyCombination(KeyCombination.keyCombination("Control"));
        //Set the key mode of the full screen exit. String can be an English Alphabet Key or a F1 key.//When you call Key Combination's NO-Math, there is no key to exit the full screen. If you don't know how to exit, you can press window+D to return to the desktop.
//Other platforms return to the desktop by Baidu
// primaryStage.setFullScreenExitKeyCombination(KeyCombination.valueOf("c")); //Equivalent to the above keyCombination ("Control") method// primaryStage.setIconified(true);//Stage minimization// primaryStage.setMaximized(true);//Maximizing Settings// primaryStage.setOpacity(0.5);//Setting Transparency Windows Method// primaryStage.setX(100);//Set the position of the stage on the screen// primaryStage.setY(100);

 

 

 

 

 
Link of this Article: JavaFX-Stage

Leave a Reply

Your email address will not be published. Required fields are marked *