Skip to Main Content

stage.setScene(newScene);

915418Dec 20 2012 — edited Dec 21 2012
Im uuing pretty mych default example file. Im trying to make default javafx program to load another scene from default button. Im using Netbeans 7.2.1.

lines which is errorious is:
Parent sceneMapRoot = FXMLLoader.load(getClass().getResource("piirros.fxml"));

would you need more information? I can also upload a package if that is needed.
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javafxapplicationfxml;

import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.control.Label;

import javafx.scene.Scene;
import javafx.stage.Stage;

/**
 *
 * @author ebure
 */
public class SampleController implements Initializable {
    
    @FXML
    private Stage  stage;
    
    @FXML
    private Label label;
    
    @FXML
    private void handleButtonAction(ActionEvent event) {


       Parent sceneMapRoot = FXMLLoader.load(getClass().getResource("piirros.fxml"));
        Scene sceneMap = new Scene(sceneMapRoot,500,500);
         
        stage.setTitle("Welcome to game!");
        stage.setScene(sceneMap);
        stage.show();
        System.out.println("You clicked me!");
        
       
    }
    
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        // TODO
    }    
}
Edited by: Ebure on 20.12.2012 6:22

Edited by: Ebure on 20.12.2012 7:04

Edited by: Ebure on 20.12.2012 7:06
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Jan 18 2013
Added on Dec 20 2012
1 comment
77 views