Professional Documents
Culture Documents
WEEK 3
Pemrograman Terdistribusi
Teknik Informatika - Multimedia
Universitas Surabaya
What is GUI
GUI (Graphical User Interface) is useful for user to interact better with the
program.
User interacts with various graphical elements such as button, Message dialog
box, menu, and etc.
Prior to Swing, AWT was used to develop GUI and rich client interface
But AWT had one major problem. AWT was platform dependent, which means a
program written in AWT behaves differently in different platforms.
Hence it defeats WORA (Write Once, Run Anywhere) purpose which is the key
Java philosophy.
Swing
Swing on the other hand is purely (100%) written in Java.
A swing application developed on one platform behaves the same on any other
platform in which Java is installed.
Hence today almost all Java programmers prefer Swing over AWT for GUI
development.
Exercise 1: Simple Calculator
Create Project
Create a new Java Application Project and give a name “GUIExcercise”
JTextField
Font: Lucinda Grande 24
HorizontalAligment:
Center
jButton
jLabel
Change the variable
JTextField name of
Font: Lucinda Grande 24
Enabled: Uncheck
components
HorizontalAligment: Center
Change Fonts and Disable TextField
Add the code inside the action methods according to the case. For example: the
"+" button is used to add 2 numbers entered by the user.
Make Employee class as an abstract class (remember the abstract class concept)
Submit your work!
ZIP and upload your works to ULS!