go to previous page   go to home page   go to next page highlighting

Answer:

Yes. The user can manipulate the window as usual.


Application

The program displays an empty window. While the program is running, you can click on the window and drag it around, you can minimize it, you can grab a border and resize it, and so on. All of this is built into the Stage class.

If you want to prevent the user from resizing the window, do this:

primaryStage.setResizable(false);

Every JavaFX program must extend the Application class and import javafx.application.Application.

import javafx.application.Application;
import javafx.stage.*;

public class TestFX extends Application
{
   .....
}


The Application class includes several methods. Its launch() method is usually called automatically. (In some programming environments, include a main() to call launch().)

The launch() method creates the Stage, calls the init() method, and then calls the start() method. The init() method as defined in Application does nothing. You can override it to do initialization, if needed. (More on this later.)

The start() method is an abstract method in the Application class, so your program must override it with a non-abstract method. The parameter for the method is a reference to the Stage that launch() created:

public void start( Stage primaryStage )

The start() method is where your program adds graphical objects to the window and where user interaction is defined. (But our program does none of that.)

The Stage remains "alive", even though there is nothing explicit in the program to keep it running. To stop the program, click on the "close button".


QUESTION 4:

What do you suppose this line from the program does?

primaryStage.show();


go to previous page   go to home page   go to next page