Java GUI Programming Notes for Informatics Practices Students

RAD (Rapid Application Development) is a method of developing software by using ready-made tools and wizards. The tools are simply dragged to the screen to design the user interface.

NetBeans IDE is a free, open source, cross platform IDE (Integrated Development Environment) with built-in support for the Java programming language.

Inspector Window shows a hierarchy of all the components contained in the currently opened form.

An Event refers to the occurrence of an activity.

A Message is the information sent to the application.

A GUI in Java is created with at least 3 kinds of objects: components, events, and listeners.

An event is an object that gets generated when the user does something (such as mouse-click, etc.).

A control is also known as a widget.

In Java, the size measurements are in points or twips. It is equal to 1/1440 of an inch. It is the smallest measurement that can be adjusted.

Adding Frames

Right-click on the Project Name. Select New. Select JFrame Form.

Text Field

String name = TextField1.getText();
int count = Integer.parseInt(TextField1.getText());
TextField1.setText("GUI Programming");

Message Dialog

import javax.swing.JOptionPane;
JOptionPane.showMessageDialog(null, "Hello World");


String s = myButton.getText();

Exit Button



String s = myLabel.getText();

Password Field

String p = new String(pwd.getPassword());

Text Area

myTextArea.setText("Hello World");
String text = myTextArea.getText();
int r = myTextArea.getRows();
int c = myTextArea.getColumns();
myTextArea.append("more text");

Check Boxes

String s = myCheckBox.getText();

Radio Buttons

Firstly create a Titled Panel for placing the Radio Buttons. Then use JButtonGroup control to group radio buttons.
String s = jRadioButton1.getText();

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.