Beruflich Dokumente
Kultur Dokumente
Lanjut
Lecture 01 - Introduction
NIKO IBRAHIM, MIT
PROGRAM STUDI SISTEM INFORMASI
FAKULTAS TEKNOLOGI INFORMASI
UNIVERSITAS KRISTEN MARANATHA
Rules
Pedoman Perkuliahan
Titip absen E
Handphone wajib di-nonaktifkan/silent
Menggunakan pakaian rapi & bersepatu
Kewajiban hadir:
Kehadiran > 15 menit, tidak boleh masuk kelas
75% kehadiran dosen (<= 25% berarti cekal)
Bila kena cekal, tidak diijinkan ikut UAS E
Pedoman Penilaian
NA= 30% UTS + 30% UAS + 15% Quiz + 25%
Praktikum
Penghitungan nilai:
Materi Keseluruhan
Java Swing
Komponen-komponen Swing
Layout Manager
Event-driven programming
Generics & Collections
File & Stream processing
Jadwal Kuliah
Session
Session 01
Session 02
Session 03 Q1
Session 04
Session 05 Q2
Session 06
Session 07 Q3
Session 08
Session 09 Q4
Session 10
Session 11 Q5
Session 12
Ujian
Lectures
Date
Materials
Pengenalan OOP Lanjut & Swing
Komponen-komponen Swing Dasar 1
Komponen-komponen Swing Dasar 2
Layout Manager
Event-Driven Programming
NetBeans GUI Builder Tutorial
Database & JDBC
Database & JDBC
Presentasi Tugas
Database & Java Persistence API (JPA)
Database & Java Persistence API (JPA)
Presentasi Tugas
Practical Work
Date
Materials
No
Amount
Proportion of
total mark
Penalties to be
applied for plagiarism
Mark = 0, for all
practical works
Mark = 0, for all
quizzes
Programming tasks
10
20%
Quizzes
10%
Assignments
10%
Mark = 0
Mid-semester Exam
25%
Final-semester Exam
25%
Reading Materials
1. Learning Java, Jonathan Knudsen & Patrick
Review: HelloMe.java
0: // Exercise 1: HelloMe.java
1: // NIK: 730015, NAMA: Niko Ibrahim
2:
public class HelloMe {
3:
public static void main (String args[ ]) {
4:
System.out.println("Hello World, Niko!");
5:
}
6:
}
Line 0: Komentar program, judul program, keterangan penting.
Line 1: Selalu tuliskan identitas penulis program.
Line 2: - Nama kelas. Setiap program Java minimal memiliki 1 deklarasi kelas.
- Kelas diawali huruf kapital untuk setiap kata.
- Untuk men-save public class ke file, harus diberi nama sesuai dengan
nama kelas
tsb dan diakhiri dengan ekstensi .java. Tentang public akan dibahas
nanti.
Line 3: main method the starting point of every Java application
Line 4: instruksi pada komputer untuk menulis suatu String (kata-kata)
Review OOP
public class SegiEmpat extends Shape{
private int tinggi;
private int lebar;
public SegiEmpat(int h, int w){
this.tinggi = h;
this.lebar = w;
}
public int luas (){
return h*w;
}
Interitance: copying
property/method of
the parent class
Property -->private
Constructor -->public, no
returned value
Static Method
Belongs to the class
K O M P O N E N - K O M P O N E N D A S A R S W I N G
L A T I H A N
ditampilkan di layar?
2. Bagaimana cara kira menyusun dan
menempatkan elemen-elemen tersebut?
3. Bagaimana kita berinteraksi dengan elemenelemen tersebut?
No 1. Components
Parts of GUI: buttons, menus, checkboxes, sliders,
frame
checkbox
label
button
No 2. Layouts
Susunan komponen di layar:
relative layouts.
No 3. Event Handling
A technique to deal with user input
Event-based model:
menyediakan 2 libraries:
release,
Swing - an improved library added later
Swing does not replace AWT , it builds on top of
AWT (an extension)
AWT vs Swing
AWT components are heavyweight
used
http://www.netbeans.org/kb/index.html
http://java.sun.com
JFrame
JPanel
JLabel
JButton
Frame
The top-level component for most Swing-based
Example: frame.setLocation(0,0);
Example: frame.setLocationRelativeTo(null);
JLabel
A label is a component that simply displays text.
Labels are used for a variety of purposes:
or
JButton
Next to labels, the Swing component you use most
or
JButton button1 = new JButton();
button1.setText("Click me!");
JPanel
A panel is a type of container thats designed to hold a
import javax.swing.*;
public class HelloFrame2 extends JFrame {
/** Creates a new instance of HelloFrame */
public HelloFrame2() {
this.setSize(200,100);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setTitle("Hello World!");
HelloPanel panel1 = new HelloPanel();
this.add(panel1);
this.setVisible(true);
this.setLocationRelativeTo(null); // set location to the center
}
FULL CODE:
Copy & paste the
codes into JGrasp
class,
object/instance,
property,
method,
constructor
I N T R O D U C T I O N T O S W I N G :
Study Guide
TO DO THIS WEEK:
Read: Java Review Diktat OOPL, Page 125
Read: Java swing 2, OReilly (chapter 1)
Run the Demo SwingSet2.jar
Study the source code of SwingSet2
Go to
http://java.sun.com/docs/books/tutorial/uiswing /