You are on page 1of 22

Rahul Talreja

Java Applets
Forgotten UI in Java

Rahul Talreja
3

GUI in Java
Rahul Talreja
4

AWT
✖ Java was first released with GUI support in
something called the Abstract Windows Toolkit
(AWT)
✖ AWT was replaced by a new library called Swing

Rahul Talreja
5

Swings
✖ Swing was designed primarily for use in desktop
applications

✖ Swing has now been replaced by a completely new GUI


library called JavaFX

✖ You can still use Swing

✖ How long until JavaFX is replaced by something else?


Nobody knows; probably many years
Rahul Talreja
6

Moving Java Forward


Rahul Talreja
7

JavaFX

From
A NewJavaFX
language
2.0,for
JavaFX
creating
is written
graphical
in user
Java Starting
from
interfaces...
JDK 8, JavaFX is part of JDK

Rahul Talreja
JavaFX : Program Structure
public class MyProgram
{
// Body of class
}

Becomes:
import javafx.application.Application;

public class MyProgram extends Application
{
// Body of class
}
Rahul Talreja
9

JavaFX
First Program

Rahul Talreja
10

JavaFX: First Program


✖ JavaFX programs are based on the analogy of a stage (think “theater
stage”).
✖ On the stage are scenes
✖ Think theater: scene’s set will have:
○ actors,
○ props,
○ backdrops,
○ lighting, etc.
✖ In JavaFX, we create the components, add them to scenes, and then
add scenes to the stage
Rahul Talreja
11

JavaFX: First Program


✖ In JavaFX, the stage is the window our code runs
in.
✖ Our applications are not limited to a single stage.

Rahul Talreja
12

JavaFX in NetBeans

Rahul Talreja
13

JavaFX in Eclipse

Rahul Talreja
14

JavaFX in Eclipse
Open Eclipse and click on Help. Choose Install a New Software from the list of options
given in the drop down menu.

Rahul Talreja
15

JavaFX in Eclipse
Type e(fx)clipse in the Name and type 
http://download.eclipse.org/efxclipse/updates-released/1.2.0/site/in the location.
Press OK to proceed with this repository installation.

Rahul Talreja
16

JavaFX in Eclipse
Click on Select All and click Next.

Rahul Talreja
17

JavaFX in Eclipse
Just click Next to continue with the installation.

Rahul Talreja
18

JavaFX in Eclipse
Now, a software agreement has been shown. Just select the radio box which says I accept
the terms and conditions and click finish.

Rahul Talreja
19

JavaFX in Eclipse
Now, the software is being installing to the eclipse. Once the process gets over, it shows
a pop-up window which asks to restart the eclipse. Just click Restart Now and wait
while restart process gets done.

Rahul Talreja
20

JavaFX in Eclipse
Now, we have installed the new software which enables us to create the new JavaFX
Application directly. We just need to click on file and choose new → project from the drop
down options.

Rahul Talreja
21

JavaFX in Eclipse
Now, we can see that there is a option of JavaFX project. We can now create JavaFX
application directly. Choose JavaFX Project and click Next.

Rahul Talreja
22

Thanks!
Any questions?
You can find me at:
Wechat
Dingtalk

Rahul Talreja

You might also like