Crimson465

Main Class

Dec 23rd, 2019
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1. import javafx.application.Application;
  2. import javafx.event.EventHandler;
  3. import javafx.fxml.FXMLLoader;
  4. import javafx.scene.Parent;
  5. import javafx.scene.Scene;
  6. import javafx.stage.Stage;
  7. import javafx.scene.input.MouseEvent;
  8.  
  9. public class AMedia extends Application {
  10.    
  11.     @Override
  12.     public void start(Stage stage) throws Exception {
  13.         Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
  14.        
  15.         Scene scene = new Scene(root);
  16.         stage.setTitle("AMedia");
  17.        
  18.         scene.setOnMouseClicked(new EventHandler<MouseEvent>() {
  19.            
  20.             @Override
  21.             public void handle(MouseEvent doubleClicked) {
  22.                 if(doubleClicked.getClickCount() == 2){
  23.                     stage.setFullScreen(true);
  24.                 }
  25.             }
  26.         });
  27.        
  28.         stage.setScene(scene);
  29.         stage.show();
  30.     }
  31.  
  32.     public static void main(String[] args) {
  33.         launch(args);
  34.     }
  35.    
  36. }
Advertisement
Add Comment
Please, Sign In to add comment