Chapter Day 23. © 2007 Pearson Addison-Wesley. All rights reserved Agenda Day 23 Problem set 4 Due Problem set 5 Posted (Last one)  Due Dec 8 Capstones.

Slides:



Advertisements
Similar presentations
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Outline Graphics Applets Drawing Shapes Components and Containers Images.
Advertisements

ITEC220 GUI Lecture – Part 2 References  Java Software Solutions,” by Lewis & Loftus  Chapter 7  Chapter 8  Chapter 9  Java Foundations-Introduction.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Java Software Solutions Foundations of Program Design Sixth Edition by Lewis & Loftus Chapter 9: Polymorphism Coming up: Binding.
Chapter 9 Polymorphism. © 2004 Pearson Addison-Wesley. All rights reserved9-2 Polymorphism Polymorphism (having many forms) is an object- oriented concept.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Chapter Day 5. © 2007 Pearson Addison-Wesley. All rights reserved2-2 Agenda Day 5 Questions from last Class?? Problem set 1 Posted  Introduction on developing.
Slides prepared by Rose Williams, Binghamton University Chapter 17 Swing I.
Chapter 5: Keyboard I/O & Simple GUI’s Copyright 2002, Matthew Evett. These slides are based on slides copyrighted by John Lewis and William Loftus, 2002,
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
© The McGraw-Hill Companies, 2006 Chapter 18 Advanced graphics programming.
Chapter Day 10. © 2007 Pearson Addison-Wesley. All rights reserved4-2 Agenda Day 10 Questions from last Class?? Problem set 2 posted  10 programs from.
Chapter 8: Animation Copyright 2002, Matthew Evett. These slides are based on slides copyrighted by John Lewis and William Loftus, 2002, and used with.
Chapter Day 14. © 2007 Pearson Addison-Wesley. All rights reserved5-2 Agenda Day 14 Problem set 3 posted  10 problems from chapters 5 & 6  Due in 11.
Chapter Day 22. © 2007 Pearson Addison-Wesley. All rights reserved Agenda Day 22 Problem set 4 Posted  10 problems from chapters 7 & 8  Due Nov 21 (right.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Chapter Day 25. © 2007 Pearson Addison-Wesley. All rights reserved Agenda Day 25 Problem set 5 Posted (Last one)  Due Dec 8 Capstones Schedule  3rd.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L03 (Chapter 15) Creating.
Chapter 9 Polymorphism 5 TH EDITION Lewis & Loftus java Software Solutions Foundations of Program Design © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter Day 21. © 2007 Pearson Addison-Wesley. All rights reserved7-2 Agenda Day 20 Problem set 4 Posted  10 problems from chapters 7 & 8  Due Nov 21.
ELC 312 Day 6. © 2004 Pearson Addison-Wesley. All rights reserved4-2 Agenda Questions? Problem set two Posted in WebCT  Due Sept 30  On Page 153&154.
Chapter Day 9. © 2007 Pearson Addison-Wesley. All rights reserved4-2 Agenda Day 8 Questions from last Class?? Problem set 2 posted  10 programs from.
Chapter Day 19. © 2007 Pearson Addison-Wesley. All rights reserved7-2 Agenda Day 19 Problem set 3 Corrected  1 A, 2 B’s and 1 D Problem set 4 Posted.
Introduction to Java Swing “We are the sultans of swing” – Mark Knopfler.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 13 Creating User.
Java Programming: From Problem Analysis to Program Design, Second Edition1  Learn about basic GUI components.  Explore how the GUI components JFrame,
CIS 068 Welcome to CIS 083 ! Introduction to GUIs: JAVA Swing.
1 CSC111H Graphical User Interfaces (GUIs) Introduction GUIs in Java Understanding Events A Simple Application The Containment Hierarchy Layout Managers.
Chapter 5: Enhancing Classes
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Graphical User Interfaces Revisited Material from Chapters
1 Event Driven Programs Rick Mercer. 2 So what happens next?  You can layout a real pretty GUI  You can click on buttons, enter text into a text field,
Graphical User Interface Components Chapter What You Will Learn Text Areas Text Areas Sliders Sliders Menus Menus –With frames –Pop up menus Look.
Ch 3-4: GUI Basics Java Software Solutions Foundations of Program Design Sixth Edition by Lewis & Loftus Coming up: GUI Components.
Graphics and Event-Driven Programming in Java John C. Ramirez Department of Computer Science University of Pittsburgh.
MSc Workshop - © S. Kamin, U. ReddyLect 3 - GUI -1 Lecture 3 - Graphical User Interfaces r GUI toolkits in Java API r JFrame r GUI components.
Chapter 4 -2 part Writing Classes 5 TH EDITION Lewis & Loftus java Software Solutions Foundations of Program Design © 2007 Pearson Addison-Wesley. All.
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.
Object Oriented Programming Engr. M. Fahad Khan Lecturer, Software Engineering Department University of Engineering & Technology, Taxila.
CS324e - Elements of Graphics and Visualization Java GUIs - Event Handling.
CHAPTER:07 JAVA IDE PROGRAMMING-II Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 – Graphical User Interfaces Java Foundations: Introduction to Programming.
ELC 310 Day 19. © 2004 Pearson Addison-Wesley. All rights reserved9-2 Agenda Questions? Capstone Proposals Overdue  4 Submitted  3 Accepted, 1 in negotiations.
Java Programming: From Problem Analysis to Program Design, 3e Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Java Software Solutions Lewis and Loftus Chapter 15 Copyright 1997 by John Lewis and William Loftus. All rights reserved. 1 Software Development Process.
Creating User Interfaces Chapter 13 CSCI CSCI 1302 – Creating User Interfaces2 Outline Introduction Common Features of Swing GUI Components Buttons.
Chapter 9 Polymorphism 5 TH EDITION Lewis & Loftus java Software Solutions Foundations of Program Design © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 10 Exceptions 5 TH EDITION Lewis & Loftus java Software Solutions Foundations of Program Design © 2007 Pearson Addison-Wesley. All rights reserved.
Oct 091 Example Program DemoInputValidation1.java DemoInputValidation2.java.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
1 Event Driven Programs Rick Mercer. 2 So what happens next?  You can layout a real pretty GUI  You can click on buttons, enter text into a text field,
Polygons and Polylines © 2004 Pearson Addison-Wesley. All rights reserved 7-1 Arrays can be helpful in graphics processing For example, they can be used.
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Chapter Topics 15.1 Graphical User Interfaces
Java GUI.
Java Programming: From Problem Analysis to Program Design,
Chap 7. Building Java Graphical User Interfaces
Graphical User Interfaces -- Introduction
Object-oriented design for multiple classes
Chapter 15: GUI Applications & Event-Driven Programming
ITEC220 GUI Lecture – Part 2 References
Presentation transcript:

Chapter Day 23

© 2007 Pearson Addison-Wesley. All rights reserved Agenda Day 23 Problem set 4 Due Problem set 5 Posted (Last one)  Due Dec 8 Capstones Schedule  2 nd Progress report Overdue  Only got two! Quiz 3 (last one) on Dec 8 New Course Grading rubric  Exams 10% each)30%  Problem Sets 8% each)40%  Group Project0%  Capstone Project 20%  Pre-professional Conduct 10% Today we will discuss event procesing and some advanced GUI Components

Chapter 9 Polymorphism 5 TH EDITION Lewis & Loftus java Software Solutions Foundations of Program Design © 2007 Pearson Addison-Wesley. All rights reserved

Outline Polymorphic References Polymorphism via Inheritance Polymorphism via Interfaces Sorting Searching Event Processing Revisited File Choosers and Color Choosers Sliders

© 2007 Pearson Addison-Wesley. All rights reserved Event Processing Polymorphism plays an important role in the development of a Java graphical user interface As we've seen, we establish a relationship between a component and a listener: JButton button = new JButton(); button.addActionListener(new MyListener()); Note that the addActionListener method is accepting a MyListener object as a parameter In fact, we can pass the addActionListener method any object that implements the ActionListener interface

© 2007 Pearson Addison-Wesley. All rights reserved Event Processing The source code for the addActionListener method accepts a parameter of type ActionListener (the interface) Because of polymorphism, any object that implements that interface is compatible with the parameter reference variable The component can call the actionPerformed method because of the relationship between the listener class and the interface Extending an adapter class to create a listener represents the same situation; the adapter class implements the appropriate interface already

© 2007 Pearson Addison-Wesley. All rights reserved Outline Polymorphic References Polymorphism via Inheritance Polymorphism via Interfaces Sorting Searching Event Processing Revisited File Choosers and Color Choosers Sliders

© 2007 Pearson Addison-Wesley. All rights reserved Dialog Boxes Recall that a dialog box is a small window that "pops up" to interact with the user for a brief, specific purpose The JOptionPane class makes it easy to create dialog boxes for presenting information, confirming an action, or accepting an input value Let's now look at two other classes that let us create specialized dialog boxes

© 2007 Pearson Addison-Wesley. All rights reserved File Choosers Situations often arise where we want the user to select a file stored on a disk drive, usually so that its contents can be read and processed A file chooser, represented by the JFileChooser class, simplifies this process The user can browse the disk and filter the file types displayed See DisplayFile.java (page 518) DisplayFile.java

© 2007 Pearson Addison-Wesley. All rights reserved Color Choosers In many situations we want to allow the user to select a color A color chooser, represented by the JColorChooser class, simplifies this process The user can choose a color from a palette or specify the color using RGB values See DisplayColor.java (page 521) DisplayColor.java More great Swing stuff 

© 2007 Pearson Addison-Wesley. All rights reserved Outline Polymorphic References Polymorphism via Inheritance Polymorphism via Interfaces Sorting Searching Event Processing Revisited File Choosers and Color Choosers Sliders

© 2007 Pearson Addison-Wesley. All rights reserved Sliders A slider is a GUI component that allows the user to specify a value within a numeric range A slider can be oriented vertically or horizontally and can have optional tick marks and labels The minimum and maximum values for the slider are set using the JSlider constructor A slider produces a change event when the slider is moved, indicating that the slider and the value it represents has changed

© 2007 Pearson Addison-Wesley. All rights reserved Sliders The following example uses three sliders to change values representing the color components of an RGB value See SlideColor.java (page 524) SlideColor.java See SlideColorPanel.java (page 525) SlideColorPanel.java

© 2007 Pearson Addison-Wesley. All rights reserved Summary Chapter 9 has focused on:  defining polymorphism and its benefits  using inheritance to create polymorphic references  using interfaces to create polymorphic references  using polymorphism to implement sorting and searching algorithms  additional GUI components