Is it possible in javafx to open new stages (windows) from another fxml with a button? Thanks for the answers.
Javafx open another fxml in the another window with button
79k Views Asked by Sevi At
2
There are 2 best solutions below
0
Sevi
On
I had to modify the code a bit and it works fine. Thank you again for the code!
public void pressButton(ActionEvent event) throws Exception {
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/A.fxml"));
Parent root1 = (Parent) fxmlLoader.load();
Stage stage = new Stage();
stage.setScene(new Scene(root1));
stage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
Related Questions in JAVAFX
- JAVAFX error incompatible types: FXMLLoader cannot be converted to node
- How to resolve browser crash issue in JavaFX?
- JavaFX can't play mp3 files
- JavaFX 8 Load external FXML
- All my JavaFX TextFields have lines in them
- Javafx TableView with custom row color using CSS
- Java for Mobile and Desktop Development
- Create Dialogs with Default Images in JavaFX (Info/Warning/Error)
- In javaFx is it possible to make rounded corner of a Rectangle except right-bottom?
- using javafx 8 (java 8 install) How to extend Label.setTooltip Display time to 20secs (while mouse is inside Tooltip)
- javaFX : How to periodically load information from db and show it on a Label?
- How to enable right click option in JavaFX Pane?
- Using ReactFX to resize stage when nodes become invisible?
- How to change collapse and expand icon for a particular treeview in javafx?
- is it possible to set a javaFX Pane origin to bottom-left?
Related Questions in WINDOW
- Dismissing the dialog by outside touch event is not working
- Java FrameDemo Error: Could not find or load main class
- C# - Allow only specific windows on top of application?
- javascript click button after be shure that page has completely loaded
- Making a Simple RPG- Creating a new JFrame
- How to give a child window bounds to not go outside the MainWindow in WPF
- How do I scale the graphics of a game?
- WPF maximize main window with center for application
- Creating a folder and registry editing script as an executable
- creating a pop-up(or is it a pop-over?) window for a webpage
- Wicket Modal Window, any way to close it if i click outside of the modal window?
- How to detect when a specific window is closed in java
- how to fit content in browse height
- how do you make a protected window in applescript?
- Window is closing immediately after I run program in PyQt 4 (anaconda) [PyCharm 4.5]
Related Questions in FXML
- JavaFX 8 Load external FXML
- Float hbox to parent
- How can I access a control that's in a grid pane?
- Load dynamic splitpane in javafx using fxml files
- How to populate data in table view with user input on button click in javaFX
- JavaFX. Where to put service class reference? Controller or Main app starter class?
- Javafx CSS values in code
- How to accomplish 3 horizontal line menu in fxml
- JavaFX8 : Single Controller for 1+1popup scene
- JavaFX TextField : Automatically transform text to uppercase
- What is wrong with this JavaFX/FXML custom component?
- FXML: ClassNotFoundException
- How can I set 3 values in spinner
- Clearing current WebView Content and reloading a different content in JavaFX
- JavaFX Modify Table View Header aligment on each column
Related Questions in STAGE
- Air for iOS SDK higher as 14, gives strange stage behavior
- JavaFX Stage - How to listen for deiconified events when maximized stage is minimized/restored?
- Transparent stage/scene loses its transparency after loading another FXML file
- How to check if the fxml window or a stage is open or not in JavaFx?
- Argument type mismatch Exception while opening a new stage
- JavaFX Real Fullscreen on macOS
- How to close current stage when clicking a button to display new stage
- Cannot find symbol error when calling method from different class file
- AS2 How to Dynamically Duplicate Movieclips Until They Fill the Stage?
- AS3 - error 1120: Access of undefined property stage
- Null Pointer Exception on Stage.draw LibGDX
- Javafx open another fxml in the another window with button
- Adobe Flash stage display specific movie clip frame
- How to propagate an event to a different stage in JavaFX
- Having problems with hitTestObject-ing a child
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Use the code below on button click: