FXML problems when open a new Stage Scene..! 08-11-2016, 06:12 PM
#1
Hello brothers first of all I apreciated the post from @Ex094 he open my eyes to create amazing gui's with FX Scene Builder.
Now I 'm codding a program for Web Masters and I'got a problem when I open a new Stage.
I've got three fxml one for the main , the second fxml has two label (with imageviews) , the thirds fxml only has and Webview
For the label I had create onmouseClicked method it looks like this
@FXML
private void openIconFinder(MouseEvent event) throws IOException {
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FXMLIcon_Finder.fxml"));
Parent root1 = (Parent) fxmlLoader.load();
Stage stage = new Stage();
stage.setScene(new Scene(root1));
stage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
okey, as you can see as I want is open a new Stage including in its the Scene created in my "FXMLIcon_Finder.fxml". but
for some reasons i cann't understand why doesn't works for me
In my Webview java controler class the code is :
public class FXMLWebViewController implements Initializable {
@FXML
private WebView webview;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
webview.getEngine().load("https://www.google.com");
}
Thanks for read me and for your time
Now I 'm codding a program for Web Masters and I'got a problem when I open a new Stage.
I've got three fxml one for the main , the second fxml has two label (with imageviews) , the thirds fxml only has and Webview
For the label I had create onmouseClicked method it looks like this
@FXML
private void openIconFinder(MouseEvent event) throws IOException {
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FXMLIcon_Finder.fxml"));
Parent root1 = (Parent) fxmlLoader.load();
Stage stage = new Stage();
stage.setScene(new Scene(root1));
stage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
okey, as you can see as I want is open a new Stage including in its the Scene created in my "FXMLIcon_Finder.fxml". but
for some reasons i cann't understand why doesn't works for me
In my Webview java controler class the code is :
public class FXMLWebViewController implements Initializable {
@FXML
private WebView webview;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
webview.getEngine().load("https://www.google.com");
}
Thanks for read me and for your time