Pemrograman Berorientasi Objek Lanjut Lecture 01 - Introduction

dokumen-dokumen yang mirip
Pemrograman Lanjut. Interface

Pemrograman Lanjut. Intro to GUI (Graphical User Interface)

Pemrograman Java III

Membuat Menu Login Sederhana [Full Coding]

GUI Nimbus. Prepared by Viska Mutiawani. 1

BAB I PROJECT NETBEANS DAN GUI SEDERHANA

GUI (Grapichal User Interface)

GUI, Ev e Ev n e t n Handling, Ex ception Handling in Java

Pemrograman Java III

BAB IX MEMBUAT FORM 9.1 Membuat Form Secara Konvensional

INSTRUKSI PENCABANGAN

BAB I PENDAHULUAN. Maksud dan tujuan dari pembuatan Aplikasi Penentu Nilai Mahasiswa pada pemrograman java adalah:

Modul 2. [access specifier] [tipe data] [nama variabel];

Object Oriented Pemrograman yang mendukung konsep objek. (inheritance, capsulation, polymorphism)

- Setiap pola yang menggambarkan permasalahan yang terjadi secara berulang, serta

Pemrograman Java III

TUJUAN. Memahami Koneksi dan Pemrosesan Basis Data di Java Memahami JDBC Menggunakan MySQL pada program Java

GUI & Event Handling. Viska Mutiawani, M.Sc. 1 Viska Mutiawani - Informatika FMIPA Unsyiah

Dasar Perancangan Graphical User Interface

Pemrograman Berorientasi Obyek. Ramos Somya

Membuat Frame, Label, TextField dan Button di Java [Full Coding]

visit :

PENDAHULUAN TENTANG NETBEANS

Creating Graphical User Interfaces [1] with Java By: De Rosal Ignatius Moses Setiadi

BINA NUSANTARA UNIVERSITY NATA LASE

Pendahuluan Dasar Pemrograman Java

BS205 Pemrograman Berorientasi Objek. Pertemuan 1 Pengenalan PBO dan Review Pemrograman Java Niko Ibrahim, S.Kom, MIT

PEMROGRAMAN II. By : Sri Rezeki Candra Nursari

BERBASIS JAVA DENGAN MENGGUNAKAN TOOLS NETBEANS

PEMROGRAMAN LANJUTAN JAVA. Dasar-Dasar Netbeans

Membuat User Interface dengan Swing. Program yang dibuat sebelumnya selalu berbasis console User lebih senang berinteraksi dengan

JAVA SWING. Swing merupakan library pada java untuk membuat sebuah tampilan seperti

Materi : GUI AWT & SWING.

BAGIAN XIII GRAPHICAL USER INTERFACE DENGAN SWING. Praktikum I : Menggunakan JFrame, JTextField, JLabel dan JButton

Pemrograman Web. Object Oriented Programming in PHP 5

Slide 6: Writing Classes

IKG2I4 / Software Project I

PEMROGRAMAN BERORIENTASI OBJEK

.NET Controls. Control Creation

PENGENALAN JAVA GUI PROGRAMMING

PEMOGRAMMAN VISUAL III APLIKASI TRANSAKSI PENJUALAN

Penggunaan Netbeans IDE, Hello World, variable dan Operator aritmetika.

Program Kalkulator Sederhana Menggunakan Java Netbeans

Pemrograman Lanjut Class, Instance Variable dan Method PTIIK

GUI & Event Handling. Viska Mutiawani, M.Sc

Konsep Dasar Pemrograman Berorientasi Objek

Program Penghitungan II Dengan Java

LAPORAN TUGAS AKHIR APLIKASI KALKULATOR BERBASIS JAVA

Pemograman Swing. Netbeans:

Dasar-Dasar Pemrograman Java

A. TUJUAN PEMBELAJARAN

VI Pemrograman Berorientasi Obyek

ADDING RTGS BENEFICIARY FOR CHECKER MAKER SYSTEM

PRAKTIKUM 1 DASAR PEMROGRAMAN JAVA

Rekomendasi Min Perangkat Keras. Prosesor dual core 1.5 GHz RAM 2 GB Monitor 10 " VGA Onboard Keyboard PS2 Mouse PS2

Menghubungkan Database Access Menggunakan Netbeans Oleh : Yuliana Setiowati

PEMROGRAMAN II. Materi : nursari2010.blogdetik.com String String Handling Java.util,Java.io. By : Sri Rezeki Candra Nursari

Prosedur dan Fungsi. Ciri prosedur pada java selalu dimulai dengan : private/public void namaprosedur ( tipedataparameter1 namaparameter1,

IKG2I4 / Software Project I

MODUL PRAKTIKUM PEMROGRAMAN BERORIENTASI OBJEK. Maimunah, S.Si,M.Kom

ANALISIS CAPAIAN OPTIMASI NILAI SUKU BUNGA BANK SENTRAL INDONESIA: SUATU PENGENALAN METODE BARU DALAM MENGANALISIS 47 VARIABEL EKONOMI UNTU

Tutorial Java Desktop 2 Melakukan Koneksi ke Database JavaDB

LAPORAN PERCOBAAN V ( MENGHITUNG NILAI UJIAN MAHASISWA) BERBASIS JAVA DENGAN MENGGUNAKAN TOOLS NETBEANS

BAHASA PEMROGRAMAN JAVA

Deskripsi Mata Kuliah. Tujuan Instruksional /Standar Kompetensi

Pemrograman Lanjut. Instance Variable Access Modifier Set dan Get Method

SYLLABUS DAN PENDAHULUAN. Astrid Lestari Tungadi, S.Kom., M.TI.

MODUL I PENGENALAN VISUAL BASIC 6.0. Visual Basic adalah sebuah program yang berfungsi untuk membuat aplikasi berbasis

06/03/2018. Tidak memiliki parameter. Melakukan inisialisasi semua variabel private dengan nilai awal.

Pemrograman Java. Pertemuan VIII By: Augury

A. TUJUAN PEMBELAJARAN

Membangun GUI (dengan AWT & Swing) OOP Java

Materi 1 Pemrograman Visual

Didalam menampilkan peta yang sudah kita buat, kita akan menggunakan Slick2D sebagai sebuah frameworknya.

PERTEMUAN 1 Membuat Project & Komponen Swing [PBO II JAVA] dosen : SOPINGI, S.Kom

Praktikum JTable. Gambar 1

APLIKASI KALKULATOR BALOK BERBASIS JAVA

Dasar Pemrograman Java

Membuat Kalkulator dengan Java

Praktikum III : Menggunakan JRadioButton

BAB IX. USER INTERFACE

PBO LANJUT USING WYSIWYG EDITOR FOR BUILDING GUI. Niko Ibrahim, MIT Universitas Kristen Maranatha

TPI4202 e-tp.ub.ac.id. Lecture 4 Mas ud Effendi

TPI4202 e-tp.ub.ac.id

PRAKTIKUM 1 DASAR PEMROGRAMAN JAVA

User interface & XML Layout

Percobaan 9 Basic Widget

IF PEMROGRAMAN LANJUT GRAPHICAL USER INTERFACE (GUI) 11 DENGAN SWING. Oleh : Andri Heryandi, M.T.

Modul 08. User Interface 01

ABSTRAK. Kata kunci: Android, Dosen, E-Learning, Kuliah, Mahasiswa, Mobile. vi Universitas Kristen Maranatha

SUKSES BERBISNIS DI INTERNET DALAM 29 HARI (INDONESIAN EDITION) BY SOKARTO SOKARTO

Pemrograman Web Lanjut

LAB02 : KODING PROGRAM

APLIKASI PERHITUNGAN NILAI MAHASISWA. Untuk membuat aplikasi nilai mahasiswa, langkah-langkahnya adalah sebagai berikut :

Modul Praktikum 9 BAB IX LAYOUTING. Departemen Teknologi Informasi Telkom Applied Science School H a l

Sekarang, kita akan mencoba untuk menganalisa program Java pertama : public class Hello {

VISUAL JAVA PROGRAMMING

Praktikum 6a Melakukan koneksi dengan basis data

KEAHLIAN PEMROGAMAN JAVA

5.Buatlah subclass world, beri nama subclass word :latar.pilih jalan.png sebagai image. Compile.

Transkripsi:

Pemrograman Berorientasi Objek Lanjut Lecture 01 - Introduction N I K O I B R A H I M, M I T P R O G R A M S T U D I S I S T E M I N F O R M A S I F A K U L T A S T E K N O L O G I I N F O R M A S I U N I V E R S I T A S K R I S T E N M A R A N A T H A

Tujuan Perkuliahan PBO Lanjut 1. Mahasiswa mampu membuat program aplikasi Java berdasarkan konsep objek oriented. 2. Mahasiwa mampu membuat program aplikasi yang berhubungan dengan database. 3. Mahasiswa memahami konsep-konsep lanjutan dalam pemrograman berorientasi objek.

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: A: 80 <= NA <= 100 B+: 73 <= NA < 80 B: 67 <= NA < 73 C+: 61 <= NA < 67 C: 55 <= NA < 61 D: 41 <= NA < 55 E: NA <41

Materi Keseluruhan Java Swing Komponen-komponen Swing Layout Manager Event-driven programming Generics & Collections File & Stream processing Database access and processing

Jadwal Kuliah Session Lectures Materials Session 01 Pengenalan OOP Lanjut & Swing Session 02 Komponen-komponen Swing Dasar 1 Session 03 Komponen-komponen Swing Dasar 2 Session 04 Layout Manager Session 05 Event-Driven Programming Session 06 NetBeans GUI Builder Tutorial UTS Session 07 Java Collection Framework Session 08 Database & JDBC Session 09 Database & JDBC Session 10 Database & Java Persistence API (JPA) Session 11 Database & Java Persistence API (JPA) Session 12 Presentasi Tugas UAS

Details of Assessable Work in The Topic No Details about each form of assessable work in the topic Amount Proportion of total mark 1 Programming tasks 10 20% 2 Quizzes 5 10% Penalties to be applied for plagiarism Mark = 0, for all practical works Mark = 0, for all quizzes 3 Assignments 2 10% Mark = 0 4 Mid-semester Exam 1 25% Mark = 0, for all exams 5 Final-semester Exam 1 25% Mark = 0, for all exams

Reading Materials 1. INTRODUCTION TO JAVA PROGRAMMING, 10th Ed., Y. Daniel Liang 2. Learning Java, Jonathan Knudsen & Patrick Niemeyer, O Reilly, 2005. (Main Reading Materials) 3. Java Swing, Matthew Robinson & Pavel Vorobiev, Manning, 2005. 4. Java API Documentation, Sun Microsystems 5. NetBeans Tutorials and Documentations

Softwares and Tools JDK 1.7 + Java API Documentation Editors: JGrasp (Simple Java editor, free download) NetBeans 7 (Java IDE, free download)

Got Any Problems? Ask directly after the class! (preferable) Email me at: niko.ibrahim@gmail.com

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; Interitance: copying property/method of the parent class Property -->private public SegiEmpat(int h, int w){ this.tinggi = h; this.lebar = w; } public int luas (){ return h*w; } Constructor -->public, no returned value Method --> public Belongs to the object/instance } public static void main (String args[ ]) { SegiEmpat s = new SegiEmpat(3,4); System.out.println("Luas: " + s.luas()); } Static Method Belongs to the class

Materi Hari Ini J A V A A W T V S J A V A S W I N G 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

3 hal penting dalam pemrograman GUI 1. Elemen-elemen (components) apa yang bisa 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, text fields, labels, and so on. API provides numerous implementations We can create own custom components radio button frame checkbox label button

No 2. Layouts Susunan komponen di layar: Absolute: x, y coordinates specified for each component (rarely used) Relative with respect to other component positions/sizes, screen resolution, fonts used etc. Layout Managers (objects) are used to deal with relative layouts.

No 3. Event Handling A technique to deal with user input Event-based model: 1. button clicked (by user) 2. event generated (by the system) 3. appropriate action taken

Java Solution: Swing Untuk melakukan GUI Programming, Java menyediakan 2 libraries: AWT (Abstract Window Toolkit), and Swing AWT - an old library, present in the first Java 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 peer-based, platform-dependant implementation (in native code). Difficult to port, platform-dependant look. Swing components are pure Java applications lightweight - do not use peers Pluggable look-and-feel - platform-independant, programmer designed look (system independent). Whenever possible Swing components should be used avoid mixing with AWT.

AWT vs Swing (2) Highest level components are heavy Each light one has a corresponding heavy one, somewhere in the hierarchy (a background to draw onto): Swing component names start from J.

Java API (JavaDoc) Sebagai programmer, JAVA API adalah suatu dokumen yang wajib dimiliki. Semua class & method (termasuk untuk Java Swing) ada di dalam dokumen ini! Dokumentasi, Tutorial, Contoh-contoh (termasuk aplikasi Swing): http://www.netbeans.org/kb/index.html http://docs.oracle.com/javase/7/docs/api/

JFrame JPanel JLabel JButton Komponen Swing Dasar

Frame The top-level component for most Swing-based applications is called a frame and is defined by the JFrame class. By itself, a frame doesn t do much. But to do anything else in Swing, you must first create a frame. The figure shows a frame that does nothing but display the message Hello, World! in its title bar.

Exercise 01: HelloFrame.java import javax.swing.*; public class HelloFrame extends JFrame { } /** Creates a new instance of HelloFrame */ public HelloFrame() { this.setsize(200,100); } this.setdefaultcloseoperation(jframe.exit_on_close); this.settitle("hello World!"); this.setvisible(true); public static void main(string[] args) { new HelloFrame(); }

Positioning the Frame On-Screen If you want to place the frame at some arbitrary location on-screen, use the setlocation method. Example: frame.setlocation(0,0); If you want to center the frame on-screen, call the setlocationrelativeto method and pass null as the parameter: Example: frame.setlocationrelativeto(null);

JLabel A label is a component that simply displays text. Labels are used for a variety of purposes: to display captions for other controls such as text fields or combo boxes, to display informational messages, or to show the results of a calculation or a database lookup. A label can also display an image, or it can display both an image and some text. And we have complete control over the appearance of the text We can specify the font, size, whether the text is bold, italic, or underlined, what color the text is displayed as, and so on. Example: JLabel label1 = new JLabel(); label1.settext("hello, World!"); or JLabel label1 = new JLabel("Hello, World!");

JButton Next to labels, the Swing component you use most is the JButton component, which creates a button the user can click. Example: JButton button1 = new JButton("Click me!"); or JButton button1 = new JButton(); button1.settext("click me!");

JPanel A panel is a type of container that s designed to hold a group of components so they can be displayed on a frame. The normal way to display a group of controls such as text fields, labels, buttons, and other GUI widgets is to add those controls to a panel, and then add the panel to the frame. Example: class HelloPanel extends JPanel{ public HelloPanel(){ JLabel label1 = new JLabel("Hello, World!"); JButton button1 = new JButton("Click me!"); } } Then, in the frame class contstructor, we create a new instance of the panel class and add it to the frame: frame.add(new HelloPanel());

Putting it all together Exercise 02: HelloFrame2.java 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 } } class HelloPanel extends JPanel{ public HelloPanel(){ // code to add components to the panel goes here JLabel label1 = new JLabel("Hello, this is label!"); this.add(label1); JButton button1 = new JButton("Click me!"); this.add(button1); } } } public static void main(string[] args) { new HelloFrame2(); FULL CODE: Copy & paste the codes into JGrasp

That s all for today! Y O U V E L E A R N E D : R E V I E W O O P : 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 : JFrame, JPanel, JLabel, JButton

To Do Today S K I M M I N G J A V A D O C 7 P R A K T I K U M 0 1 P E N G E N A L A N J A V A S W I N G

Study Guide T O D O T H I S W E E K : R e a d : J a v a R e v i e w D i k t a t O O P L, P a g e 1 2 5 R e a d : J a v a s w i n g 2, O R e i l l y ( c h a p t e r 1 ) R u n t h e D e m o S w i n g S e t 2. j a r S t u d y t h e s o u r c e c o d e o f S w i n g S e t 2 G o t o h t t p : / / j a v a. s u n. c o m / d o c s / b o o k s / t u t o r i a l / u i s w i n g /