Wednesday, June 3, 2015

MODUL 8 : JAVA SWING

A.      Objectives
Objectives of this practical laboratory are :
1.       Students are able to understand what the definition of Java Swing.
2.       Stundets are able to implement Java Swing in this practical laboratory.

B.      Theoritical Basic
Swing is other alternative to implement window programming. Although implemented based on AWT class, swing doesn’t use components that’s on AWT so that component appearance of swing is not depending on local window system. So, graphics of swing for all operating system become similar.

C.      Tools And Materials
1.       Laptop
2.       Java Development Kit (JDK 8)
3.       Netbeans IDE 8.0.2

D.      Work Steps
1.       Experiment Steps
a.       Opening Netbeans.
b.      Right clicking on project and making a new jFrame Form.
c.       Then, adding jPanel component on the form already made.

d.      Adding menu component and changing the name become “Ubah warna”.

e.      Then giving menu item component on menu so that when clicking the menu, it will be appear a dropdown of menu.

f.        On panel inspector, chosing one of menu item that will be given an action so that when the menu item clicked, it will change the color of window background.
Right clicking on menu item -- chosing Even -- actionPerformed.
g.       Adding this code below of actionPerformed.
jPanel1.setBackground(Color.Red);
jLabel1.setText(“Warna Background Merah”);
h.      The code above will change the color of background become “Red” and center of window will  be written “Warna Background Merah”.


E.       Analyze
Code of jPanel1.setBackground(Color.Red);  sets background of Panel 1 having Red Color.
Code of jLabel1.setText(“Warna Background Merah”);  sets text of Label 1 written “Warna Backgroung Merah”.


F.       Tasks
1.       Adding 2 colors (Green and Yellow).


2.       Adding icon symbol beside on menu item.


No comments:

Post a Comment