IM103 week 11 Part 2 P532 Case Study part 2: the Airport GUI Learning objectives By the end of this lecture you should be able to:  use the JTabbedPane.

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming
Advertisements

Graphical User Interfaces (Part IV)
Editing and Formatting Document
ITEC220 GUI Lecture – Part 2 References  Java Software Solutions,” by Lewis & Loftus  Chapter 7  Chapter 8  Chapter 9  Java Foundations-Introduction.
Fall 2007CS 225 Graphical User Interfaces Event Handling Appendix C.
 What are the basic GUI components we’ve learned so far? › JFrame › JPanel › JButton › JLabel › JTextArea › JTextField › JCheckBox › JRadioButton › Paint.
Unit 091 Introduction to GUI Programming Introduction to User Interfaces Introduction to GUI Programming GUI Design Issues GUI Programming Issues Java.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Slides prepared by Rose Williams, Binghamton University Chapter 17 Swing I.
Graphical User Interfaces (GUIs) GUI: An application that uses graphical objects to interact with users GUI applications consist of: –Events: A user or.
1 GUI Elements in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Chapter 13: Advanced GUIs and Graphics J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
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.
GUI and Event-Driven Programming Part 2. Event Handling An action involving a GUI object, such as clicking a button, is called an event. The mechanism.
CPSC150 Week 12 Graphical User Interfaces Chapter 11.
Basic Editing Lesson 2- Part 2. Navigating and Searching Through a Document Find command options, the mouse, scroll bars, and various keystroke and keyboard.
More on Creating GUIs in Java using Swing David Meredith Aalborg University.
Module 3 Productivity Programs Common Features and Commands Microsoft Office 2007.
Access Tutorial 10 Automating Tasks with Macros
CC1007NI: Further Programming Week 5 Dhruba Sen Module Leader (Islington College)
Graphic User Interfaces Part 1. Typical GUI Screen from Microsoft Word What GUI “components” can you see? –Menus? Buttons? Labels? What else? –Anything.
PROGRAMMING REVIEW Lab 2 EECS 448 Dr Fengjun Li and Meenakshi Mishra.
Microsoft Visual Basic 2012 CHAPTER TWO Program and Graphical User Interface Design.
Visual Basic 2005 CHAPTER 2 Program and Graphical User Interface Design.
Object Oriented Programming Ders 11: Interfaces Mustafa Emre İlal
MIT AITI 2003 Lecture 17. Swing - Part II. The Java Event Model Up until now, we have focused on GUI's to present information (with one exception) Up.
Java GUI CSCE 190 – Java Instructor: Joel Gompert Mon, July 26, 2004.
Graphical User Interface Components Chapter What You Will Learn Text Areas Text Areas Sliders Sliders Menus Menus –With frames –Pop up menus Look.
Oct 071 Example Program DemoLookAndFeel.java Metal (java) Motif Windows.
Dale Roberts GUI Programming using Java - Introduction Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Chapter 9: Visual Programming Basics Object-Oriented Program Development Using Java: A Class-Centered Approach.
GUIs in Java Swing, Events CS2110, SW Development Methods Readings: MSD, Chapter 12 Lab Exercise.
Ch 3-4: GUI Basics Java Software Solutions Foundations of Program Design Sixth Edition by Lewis & Loftus Coming up: GUI Components.
1 CSC111H Graphical User Interfaces (GUIs) Introduction GUIs in Java Understanding Events A Simple Application The Containment Hierarchy Layout Managers.
– Advanced Programming P ROGRAMMING IN Lecture 21 Introduction to Swing.
FEN IntroJava2006 AAU1 GUI: Graphical User Interface AWT/SWING: Components Drag and Drop in NetBeans Events Listeners.
Graphical User Interfaces (Part 2) 1. View  view  presents the user with a sensory (visual, audio, haptic) representation of the model state  a user.
Chapter 12Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Announcements/Reminders l Next week: »No Lectures »No Labs »Recitation.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Creating Windows. How can we use Java to create programs that use windows (GUI applications)? How can we use Java to create programs that use windows.
Lesson No: 6 Introduction to Windows XP CHBT-01 Basic Micro process & Computer Operation.
CHAPTER:07 JAVA IDE PROGRAMMING-II Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
CS1054: Lecture 21 - Graphical User Interface. Graphical User Interfaces vs. Text User Interface.
Java GUI. Graphical User Interface (GUI) a list a button a text field a label combo box checkbox.
Microsoft Visual Basic 2010 CHAPTER TWO Program and Graphical User Interface Design.
1 Chapter 16: Creating Windows. 2 Basics of GUI Programming How to create a Window. TryWindow.java You always need a JFrame component before creating.
Creating a Window. A basic window in Java is represented by an object of the class Window in the package java.awt.
Ajmer Singh PGT(IP) JAVA IDE Programming - I. Ajmer Singh PGT(IP) GUI (Graphical User Interface) It is an interface that uses a graphic entities along.
Java Programming, Second Edition Chapter Thirteen Understanding Swing Components.
Computer Science [3] Java Programming II - Laboratory Course Lab 4 -1 : Introduction to Graphical user interface GUI Components Faculty of Engineering.
Oct 091 Example Program DemoInputValidation1.java DemoInputValidation2.java.
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
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 Swing Mr. Crone. What is Swing? a collection of pre-made Java classes used to create a modern graphical user interface.
Introduction to Swing Mr. Crone. What is Swing? a collection of pre-made Java classes used to create a modern graphical user interface.
A Quick Java Swing Tutorial
Chapter 9: Graphical User Interfaces
Provision for GUIs in Java
A First Look at GUI Applications
Java Swing.
Provision for GUIs in Java
Graphical user interface with Swing by jose maria gonzalez pinto
Program and Graphical User Interface Design
University of Central Florida COP 3330 Object Oriented Programming
Program and Graphical User Interface Design
Event Driven Programming and Graphical User Interface
Basic Elements of The GUI
Courses Tab Press the Courses tab
ITEC220 GUI Lecture – Part 2 References
Presentation transcript:

IM103 week 11 Part 2 P532 Case Study part 2: the Airport GUI Learning objectives By the end of this lecture you should be able to:  use the JTabbedPane Swing class to create an attractive user interface;  add tool tips to Swing components using the setToolTipText method;  add short cut keys to Swing menu items using the setMnemonic method.

Swing based design of the GUI JFrame JTabbedPane JMenuBar JPanel JButton JLabel

The JTabbedPane class You can think of a JTabbedPane component as a collection of overlapping tabbed "cards", on which you place other user interface components. A particular card is revealed by clicking on its tab. at the moment the first tab is selected components associated with the other two tabs are kept hidden until the tabs are clicked these components are added to the JPanel the first tabbed component is a JPanel

Creating a JTabbedPane // constructor created an empty JTabbedPane JTabbedPane tabs = new JTabbedPane(); // create a JPanel component JPanel controlPanel = new Jpanel(); /* other components can be added to this panel either now or later */ /* add this panel to the JTabbedPane component and give the tab a title */ tabs.addTab("Flight Control", controlPanel,);

Both "Flight Arrivals" and "Flight Departures" consist of a text area

Adding a JTextArea to a JTabbedPane To add scroll bars to a JTextArea, the JTextArea component has to be added to a JScrollPane component. The JScrollPane is then added to the JTabbedPane as follows: // create text area JTextArea jtaArrivals = new JTextArea(30,20); // add text area to scroll pane JScrollPane jspArrivals = new JScrollPane(jtaArrivals); // add scroll pane to JTabbedPane component tabs.addTab("Flight Arrivals", jspArrivals);

Tool Tips A tool tip is an informative description of the purpose of a GUI component. This informative description is revealed when the user places the cursor over the component. We have added tool tips to our buttons.

The setToolTipText method Adding a tool tip to a Swing component is easy; just use the setToolTipText method: // create Swing component JButton jbtnBoard = new JButton ("Board"); // add tool tip text jbtnBoard.setToolTipText ("Record a flight as ready for boarding");

Short cut keys Ordinarily, a graphical component is selected by clicking on it with a mouse. Sometimes it is convenient to provide keyboard access to such items by means of a short cut. the underlined 'F' indicates that this menu can be selected by pressing ALT-F

The setMnemonic method: Creating keyboard short cuts for Swing components is straightforward, just use the setMnemonic method: // create Swing component JMenu fileMenu = new JMenu("File"); // add keyboard shortcut fileMenu.setMnemonic('F');

Airport Dialogue Boxes Whenever a button is selected in the "Flight Control" screen, a dialogue box is required to get and process user input.

Implementing the Airport Dialogs It makes sense to generalise common features of the dialogue into a base class, AirportDialog, and then use inheritance to develop the specialized dialogue classes: AirportDialog LandingDialogBoardingDialogTakeOffDialogRequestToLandDialogRegisterDialog JDialog Code for all classes are discussed in Charatan and Kans chapter 21.