Gui Programming - II Teguh Sutanto, M.Kom.

Slides:



Advertisements
Similar presentations
FH-Hof Dialoge Richard Göbel. FH-Hof Inhalt JDialog Vordefinierte Dialoge File Browser.
Advertisements

Introduction to Java 2 Programming
Chapter 11 Creating User Interfaces F What is JavaBean? F JComponent F JButton  ImageIcon  JLabel  JTextField  JTextArea  JComboBox  JList  JCheckBox.
Graphical User Interfaces (Part IV)
 What are the basic GUI components we’ve learned so far? › JFrame › JPanel › JButton › JLabel › JTextArea › JTextField › JCheckBox › JRadioButton › Paint.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 29 Menus, Toolbars,
1 Chapter 23 Menus, Toolbars, Dialogs, and Internal Frames.
CPSC150 Week 12 Graphical User Interfaces Chapter 11.
1 GUI Elements in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Scott Grissom, copyright 2006Ch 11: GUI Slide 1 Graphical User Interfaces (Ch 11) Careful design of a graphical user interface is key to a viable software.
1 L47 Advanced GUI Component (2). 2 OBJECTIVES  To create and manipulate pop-up menus and windows.  To change the look-and-feel of a GUI, using Swing's.
1 L46 Advanced GUI Component (1). 2 OBJECTIVES  To create and manipulate sliders, and menus,
Advanced Java Class GUI, part 2. JComponent methods addXXXListener(XXXListener) repaint() – [optional arguments: delay and coordinates of sub-area to.
More on Creating GUIs in Java using Swing David Meredith Aalborg University.
CC1007NI: Further Programming Week 5 Dhruba Sen Module Leader (Islington College)
F27SB2 Software Development 2 Lecture 9: Java GUIs 6.
Intro to GUIs (Graphical User Interfaces) Section 2.5Intro. to GUIs: a GUI Greeter Section 3.7Graphical/Internet Java: Einstein's Equation.
Creating User Interfaces F JComponent F JButton F JLabel F JTextField F JTextArea F JComboBox F JList F JCheckBox F JRadioButton F Dialogs.
Introduction to GUI in Java 1. Graphical User Interface Java is equipped with many powerful,easy to use GUI component such as input and output dialog.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved
Chapter 9: Creating User Interfaces What is JavaBean? What is JavaBean? JComponent JComponent JButton JButton JLabel JLabel JTextField JTextField JTextArea.
10/24/20151 Java GUI Programming. 10/24/20152 What is a GUI? Java has standard packages for creating custom Graphical User Interfaces Some of the fundamental.
Dale Roberts GUI Programming using Java - Introduction Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
SWING. AbstractButton Swing Buttons are subclasses of the AbstractButton class, which extends JComponent. Abstract class javax.swing.AbstractButton AbstractButton.
GUI Clients 1 Enterprise Applications CE00465-M Clients with Graphical User Interfaces.
Chapter 9: Creating User Interfaces What is JavaBean? What is JavaBean? JComponent JComponent Jbutton Jbutton ImageIcon ImageIcon JLabel JLabel JTextField.
Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Copyright © 2006 by Maria Litvin, Gary Litvin, and Skylight.
Java Programming: Advanced Topics 1 Components and Facilities for Rich Graphical User Interfaces Chapter 7.
Timer class and inner classes. Processing timer events Timer is part of javax.swing helps manage activity over time Use it to set up a timer to generate.
Graphical User Interfaces (Part 2) 1. View  view  presents the user with a sensory (visual, audio, haptic) representation of the model state  a user.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 34 Menus, Toolbars,
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
CS1054: Lecture 21 - Graphical User Interface. Graphical User Interfaces vs. Text User Interface.
Introduction to GUI in 1 Graphical User Interface 2 Nouf Almunyif.
Option Panes CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Swing - 2 Session 13. Swing - 2 / 2 of 38 Objectives (1) Discuss trees and tables Discuss progress bars Discuss MVC architecture Describe menus.
SD2054 Software Development. By the end of this lecture you should be able to: Advanced Graphics Programming create pull down menus create combo boxes.
Creating User Interfaces Event-Driven Programming.
Creating a Window. A basic window in Java is represented by an object of the class Window in the package java.awt.
Software Construction LAB 08 Java Programming with SWING GUI Builder.
Computer Science [3] Java Programming II - Laboratory Course Lab 4 -1 : Introduction to Graphical user interface GUI Components Faculty of Engineering.
Slides prepared by Rose Williams, Binghamton University ICS201 Lecture 15 : Swing III King Fahd University of Petroleum & Minerals College of Computer.
Lecture # 6 Graphical User Interface(GUI). Introduction A graphical user interface (GUI) presents a user- friendly mechanism for interacting with an application.
Creating and Using Dialogs ● A dialog is a box that pops up and prompts the user for a value or informs them of something ● One way: directly create objects.
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
Menus and Toolbars CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
View  view  presents the user with a sensory (visual, audio, haptic) representation of the model state  a user interface element (the user interface.
Introduction to GUI in 1 Graphical User Interface 3 Nouf Almunyif.
Menus Pull-downs and popups. Tooltips –a ToolTip is a context-sensitive text string that is displayed in a popup window when the mouse rests over a particular.
Objects First With Java A Practical Introduction Using BlueJ Building Graphical User Interfaces (GUIs) Week
CIS 270—Application Development II Chapter 11—GUI Components: Part I.
제 14 장 고급 스윙 컴포넌트.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 7 ( Book Chapter 14) GUI and Event-Driven Programming.
A Quick Java Swing Tutorial
Christopher Budo, Davis Nygren, spencer franks, Luke miller
Building a Swing Interface
·  Chapter 29 Menus.
Advanced User Interfaces
Advanced GUI Programming
Section 64 – Manipulating Data Using Methods – Java Swing
Example Program DemoLowLevelEvents.java DemoHighLevelEvents.java
Message, Input, Confirm, and Specialized Dialogs
JOptionPane Dialogs javax.swing.JOptionPane is a class for creating dialog boxes. Has both static methods and instance methods for dialogs. Easy to create.
Timer class and inner classes
IFS410: Advanced Analysis and Design
CS18000: Problem Solving and Object-Oriented Programming
Message, Input, and Confirm Dialogs
Ch. No Name Marks 01 AWT Networking JDBC Swing 05
Ch. No Name Marks 01 AWT Networking JDBC Swing 05
TA: Nouf Al-Harbi NoufNaief.net :::
Presentation transcript:

Gui Programming - II Teguh Sutanto, M.Kom.

Tujuan Mahasiswa dapat membuat Menu dan ToolBar Mahasiswa dapat membuat dialog konfirmasi

Menus Menus make selection easier and are widely used in window applications. Java provides five classes that implement menus: JMenuBar, JMenu, JMenuItem, JCheckBoxMenuItem, and JRadioButtonMenuItem. JMenuBar is a top-level menu component used to hold the menus. A menu consists of menu items that the user can select (or toggle on or off). A menu item can be an instance of JMenuItem, JCheckBoxMenuItem, or JRadioButtonMenuItem. Menu items can be associated with icons, keyboard mnemonics, and keyboard accelerators. Menu items can be separated using separators.

3 Langkah Membuat Menu Buat Menu Bar Buat Menu Buat MenuItem

Membuat Menu Bar

Membuat Menu (JMenu)

Menambahkan MenuItem

Menambahkan Icon

Membuat ToolBar JButton btnOpen=new JButton("Open"); JButton btnNew=new JButton("New"); JButton btnExit=new JButton("Exit"); ImageIcon iconOpen = new ImageIcon("./gambar/folder.png"); btnOpen.setIcon(iconOpen); ImageIcon iconNew = new ImageIcon("./gambar/folder_add.png"); btnNew.setIcon(iconNew); ImageIcon iconStop = new ImageIcon("./gambar/stop.png"); btnExit.setIcon(iconStop); JToolBar toolBar=new JToolBar(); toolBar.add(btnNew); toolBar.add(btnOpen); toolBar.add(btnExit); getContentPane().setLayout(new BorderLayout()); getContentPane().add(toolBar,BorderLayout.NORTH);

Membuat Dialog (JOptionPane) Message dialog shows a message and waits for the user to click OK. Confirmation dialog shows a question and asks for confirmation, such as OK or Cancel. Input dialog shows a question and gets the user’s input from a text field, combo box, or list. Option dialog shows a question and gets the user’s answer from a set of options.

Membut Konfirmasi Dialog public static int showConfirmDialog(Component parentComponent, public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType) public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType) public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon)

Oke…kita ketemu di Demo/Presentasi 13 Januari 2014