Yes. For example, if you double the resolution of the monitor, twice as many pixels now correspond to the width of the monitor. The width of the rectangle will be half the previous width. Of course, the physical glowing dots of the monitor don't change. But now 300 pixels correspond to fewer glowing dots.
All JavaFX programs must extend the Application
class.
The JavaFX runtime system
follows these steps when your program starts:
1. Construct an instance of your extension of the Application
class.
Your object will inherit the methods of Application
.
You can override these methods.
2. Call the init()
method.
Theinit()
method is a member of theApplication
class. As defined in that class, it does nothing. Your class (which extendsApplication
) can override it to perform initialization tasks on start-up. You might open a file, read parameters from the command line, or ask the user for values from the command line.
For now, you can just ignore init()
.
3. Call your start(Stage)
method.
Thestart()
method, as defined inApplication
, is abstract, so you must override it.
Thestart()
method puts graphical objects in aScene
and puts aScene
on theStage
. User interaction can be set up. Thestart()
method runs to its end.
4. Wait for the application to finish.
The window (Stage
) stays on the screen until the close button is
clicked or it is closed by some other means.
5. Call the stop()
method.
This method is defined inApplication
, but does nothing. You might implement it in yourApplication
to close the files or databases opened in theinit()
method. For now, you can ignorestop()
.
What (do you suppose) this statement does:
Circle circ = new Circle();