JAVA API (GUI) - Binus Repository

advertisement
JAVA API (GUI)
Subject
Session
Tahun
Versi
:
:
:
:
T0934 / Multimedia Programming Foundation
1
2009
1/0
Learning Outcomes
In the end of this session, students must
be able to:
– recognize Java technology
– understand the concept of Graphics
User Interfaces (GUI)
– recognize the components and user
actions of GUI
– recognize Look And Feel (LAF) in
Java
Bina Nusantara
Course Outlines
•
•
•
•
•
•
Java Technology
Graphics User Interface (GUI)
User Interface Components
User Actions (Interactions)
Java GUI
User Interface Manager (Look And Feel)
Bina Nusantara
Java Technology
• Both a programming language and a platform
• Java programming language is a high-level
language that can be characterized by all of the
following buzzwords:
–
–
–
–
–
–
–
–
–
–
–
Bina Nusantara
Simple
Object Oriented
Distributed
Interpreted
Robust
Secure
Architecture Neutral
Portable
High performance
Multithreaded
Dynamic
Java Technology
• Software development process:
• JVM
(multiple platforms)
Bina Nusantara
Java Technology
• Platform is the hardware or software
environment in which a program runs.
• The Java platform has two components:
– The Java Virtual Machine
– The Java Application Programming Interface (API)
• API: Core functionality of the Java.
– Classes: basic objects,
networking and security,
XML generation and
database access, and more
Bina Nusantara
Graphics User Interface (GUI)
• Pronounced /’ɡu:i/  “goo-ey”
• Human-computer interface (way for
humans to interact with computers)
• Uses windows, icons and menus
• Can be manipulated by a mouse
• Often to a limited extent by a keyboard
• Three Concepts:
– Graphics (text, image, geometric figures)
– User Interface Components
– User Actions (Interactions)
Bina Nusantara
User Interface Components
Title Bar
Mnemonics
Menu Bar
Menu Items
Frame
(Top-level Window)
Image Icon
Text Field
Tab Pane
Check Box
Combo Box
Radio Button
Vertical Scroll Bar
Button
Horizontal Scroll Bar
Bina Nusantara
User Actions (Interactions)
•
•
•
•
Key
Mouse
Button
Menu
Actions:
• Press Key
• Click Mouse
• Click Button
• Select Menu
Events:
• Key Event
• Mouse Event
• Action Event
• Action Event
causes
Listen
Handle
respond
action
User
User
click
show
click
show
Bina Nusantara
PROGRAM
notify
Sample Code
Bina Nusantara
Sample Code
Bina Nusantara
Sample Code
• File saved as “ComponentsSample.java”
• setBounds(int x, int y, int width, int height)
• See JDK Documentation as tutorial
Bina Nusantara
Sample Code
setTitle("Components Sample");
JFrame
setSize(300,200);
JLabel
label.setBounds(10,10,120,20);
JCheckBox
checkBox.setBounds(5,40,150,20);
JTextField
textField.setBounds(130,10,150,20);
JComboBox
comboBox.setBounds(160,40,120,20);
Bina Nusantara
JPanel
JButton
button.setBounds(210,80,70,20);
Java GUI
• Java GUI classes:
– Container Classes
• JFrame, JPanel, JApplet
– Component Classes
• JButton, JTextField, JTextArea,
JComboBox, etc
– Helper Classes
• Graphics, Color, Font, Dimension, etc
• Java GUI Components:
– Abstract Windows Toolkit (AWT) 
heavyweight components
• Button, TextField, TextArea,
ComboBox, etc
– Swing  lightweight components
Bina Nusantara
• JButton, JTextField, JTextArea,
JComboBox, etc
Java GUI
Bina Nusantara
Java GUI
Bina Nusantara
Java GUI
Bina Nusantara
Java GUI
Bina Nusantara
Java GUI
Bina Nusantara
Java GUI
• Java also has a very good system for Look
and Feels (LAFs)  See Additional
Material 1
Bina Nusantara
Java
• Java can be downloaded at:
http://java.sun.com/javase/downloads/inde
x.jsp
• Java Documentation (help) can be
downloaded at:
http://java.sun.com/javase/6/docs/api/inde
x.html or
http://java.sun.com/javase/downloads/inde
x.jsp
Bina Nusantara
References
•
•
•
•
•
•
•
•
•
•
About the Java Technology. Sun Microsystems. 2008.
http://java.sun.com/docs/books/tutorial/getStarted/intro/definition.html
Characteristics of Java. Liang. 2009.
http://www.cs.armstrong.edu/liang/intro6e/JavaCharacteristics.pdf
The Java Language Environment. Sun Microsystems. 2009.
http://java.sun.com/docs/white/langenv/Intro.doc2.html#334
What Can Java Technology Do?. Sun Microsystems. 2009.
http://java.sun.com/docs/books/tutorial/getStarted/intro/cando.html
Java Technology Concept Map. Sun Microsystems. 2009.
http://java.sun.com/new2java/javamap/Java_Technology_Concept_Map.pdf
Java Technology. University of Wollongong. 2004.
GUI Definition. Linfo. 2004. http://www.linfo.org/gui.html
Graphics Programming. University of Wollongong. 2004.
Graphical User Interface. Wikipedia. 2009.
http://en.wikipedia.org/wiki/Graphical_user_interface
Elements of graphical user interfaces. Wikipedia. 2009.
http://en.wikipedia.org/wiki/Elements_of_graphical_user_interfaces
Bina Nusantara
References
•
•
•
•
•
•
•
java.awt.Component Hierarchy Class Diagram. Falkhausen. 2009.
http://www.falkhausen.de/en/diagram/html/java.awt.Components.html
javax.swing.* Class Diagrams. Falkhausen. 2009.
http://www.falkhausen.de/en/diagram/spec/javax.swing.html
Java Swing Classes. Holub. 1999.
http://www.holub.com/goodies/images/swing_component_hierarchy.gif
Introduction to Java Programming. 7ed. Liang. 2009. p13.
Swing Components and Containment Hierarchy. The Hong Kong Polytechnic
University. 2009. http://www.eie.polyu.edu.hk/~enzheru/gui-0405/final-ppt/java5.ppt
Java SE Downloads. Sun Microsystems. 2009.
http://java.sun.com/javase/downloads/index.jsp
Java Overview (Documentation). Sun Microsystems. 2009.
http://java.sun.com/javase/6/docs/api/index.html
Bina Nusantara
Download