Java Swing Tutorials - Herong's Tutorial Examples - v4.32, by Herong Yang
Writing My First Java Program
This section provides a tutorial example on how to write, compile, and execute the first Java program with JDK 1.8.0.
When JDK is installed on your machine, it provides two commands for you to compile and run Java programs.
Let's try these commands with a very simple Java program. Use NotePad to enter the following Java program into a file called Hello.java:
class Hello { public static void main(String[] a) { System.out.println("Hello world!"); } }
Then compile this program in a command window with the "javac" command:
herong> javac Hello.java
To execute the program, use the java command:
herong> java Hello Hello world!
Congratulations, you have successfully entered, compiled and executed your first Java program.
Table of Contents
Downloading and Installing JDK 20
►Writing My First Java Program
Adding JDK "bin" Directory to Path Setting
JDK Documentation Installation
Introduction of Java Swing Package
Graphics Environment of the Local System
JCheckBox - Swing Check Box Class
JRadioButton - Swing Radio Button Class
JTextField - Swing Text Field Class
JComboBox - Swing Combo Box Class
Menu Bar, Menus, Menu Items and Listeners
Creating Internal Frames inside the Main Frame
Layout of Components in a Container
JEditorPane - The Editor Pane Class
SwingWorker - The Background Task Worker
AWT (Abstract Windows Toolkit)