Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

Open another window in IntelliJ using JavaFX

Tiempo de lectura: 2 minutos

Reading time: 2 minutes

To do this, we will first design one of the windows where we create a button that, when pressed, will open another window with a different design.

Each window or class in IntelliJ must have its corresponding FXML, as shown below:

In this case, our main window will be “devcodelight.fxml”, where we will find the design with a button with its id = “btn_ventana”, as follows:

Regarding the FXML code to add the button, it would be as follows:

When clicking on it, the following window will open, which in this case will have the following design:

The next step is to add the action to the button. To do this, we will add an “On Action” in the FXML:

We will create the method in the associated class (Devcodelight), declare the previously created button in case we want to modify it in the future when performing the action, and finally, simply add the following code inside the method:

We will run the application and check the result:

0

Leave a Comment