×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: abdul qayyum
Added: Aug 15, 2015 10:37 PM
Views: 13
Tags: no tags
Goto the Next Scene
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package trainingfx;
  7.  
  8. import java.io.IOException;
  9. import java.net.URL;
  10. import java.util.ResourceBundle;
  11. import javafx.beans.property.StringProperty;
  12. import javafx.event.ActionEvent;
  13. import javafx.fxml.FXML;
  14. import javafx.fxml.FXMLLoader;
  15. import javafx.fxml.Initializable;
  16. import javafx.scene.Parent;
  17. import javafx.scene.Scene;
  18. import javafx.scene.control.Button;
  19. import javafx.scene.control.CheckBox;
  20. import javafx.scene.control.Label;
  21. import javafx.scene.control.TextField;
  22. import javafx.scene.input.MouseEvent;
  23. import javafx.stage.Stage;
  24.  
  25. /**
  26.  *
  27.  * @author USER
  28.  */
  29. public class FXMLDocumentController implements Initializable {
  30.    
  31.     @FXML
  32.     Button goto2;
  33.     Stage stage;
  34.     Parent root;
  35.    
  36.     //Goto the next Scene
  37.     public void handleButton(MouseEvent event) throws IOException{
  38.         if(event.getSource() == goto2){
  39.             stage = (Stage) goto2.getScene().getWindow();
  40.             root = FXMLLoader.load(getClass().getResource("FXMLDocument2.fxml"));          
  41.         }
  42.        
  43.         Scene scene  = new Scene(root);
  44.         stage.setScene(scene);
  45.         stage.show();
  46.     }
  47.    
  48.     @Override
  49.     public void initialize(URL url, ResourceBundle rb) {
  50.  
  51.     }    
  52.    
  53. }
  54.