We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published byMerry Ford
Modified about 1 year ago
ITEC220 GUI Lecture – Part 2 References Java Software Solutions,” by Lewis & Loftus Chapter 7 Chapter 8 Chapter 9 Java Foundations-Introduction to Program Design & Data Structures,” by Lewis, DePasquale, and Chase Chapter 6
Chapter 7 Arrays References Java Software Solutions,” by Lewis & Loftus Chapter 7 Chapter 8 Chapter 9 Java Foundations-Introduction to Program Design & Data Structures,” by Lewis, DePasquale, and Chase Chapter 6
© 2004 Pearson Addison-Wesley. All rights reserved2-3 Outline Mouse Events and Key Events
© 2004 Pearson Addison-Wesley. All rights reserved2-4 Mouse Events Events related to the mouse are separated into mouse events and mouse motion events Mouse Events: mouse pressedthe mouse button is pressed down mouse releasedthe mouse button is released mouse clickedthe mouse button is pressed down and released without moving the mouse in between mouse enteredthe mouse pointer is moved onto (over) a component mouse exitedthe mouse pointer is moved off of a component
© 2004 Pearson Addison-Wesley. All rights reserved2-5 Mouse Events Mouse Motion Events: mouse movedthe mouse is moved mouse draggedthe mouse is moved while the mouse button is pressed down Listeners for mouse events are created using the MouseListener and MouseMotionListener interfaces A MouseEvent object is passed to the appropriate method when a mouse event occurs
© 2004 Pearson Addison-Wesley. All rights reserved2-6 Mouse Events For a given program, we may only care about one or two mouse events To satisfy the implementation of a listener interface, empty methods must be provided for unused events See Dots.java (page 413) Dots.java See DotsPanel.java (page 414) DotsPanel.java
© 2004 Pearson Addison-Wesley. All rights reserved2-7 Mouse Events Rubberbanding is the visual effect in which a shape is "stretched" as it is drawn using the mouse The following example continually redraws a line as the mouse is dragged See RubberLines.java (page 417) RubberLines.java See RubberLinesPanel.java (page 418) RubberLinesPanel.java
© 2004 Pearson Addison-Wesley. All rights reserved2-8 Key Events A key event is generated when the user types on the keyboard key presseda key on the keyboard is pressed down key releaseda key on the keyboard is released key typeda key on the keyboard is pressed down and released Listeners for key events are created by implementing the KeyListener interface A KeyEvent object is passed to the appropriate method when a key event occurs
© 2004 Pearson Addison-Wesley. All rights reserved2-9 Key Events The component that generates a key event is the one that has the current keyboard focus Constants in the KeyEvent class can be used to determine which key was pressed The following example "moves" an image of an arrow as the user types the keyboard arrow keys See Direction.java (page 421) Direction.java See DirectionPanel.java (page 422) DirectionPanel.java
Chapter 8 Inheritance References Java Software Solutions,” by Lewis & Loftus Chapter 7 Chapter 8 Chapter 9 Java Foundations-Introduction to Program Design & Data Structures,” by Lewis, DePasquale, and Chase Chapter 6
© 2004 Pearson Addison-Wesley. All rights reserved2-11 Outline The Timer Class
© 2004 Pearson Addison-Wesley. All rights reserved2-12 The Timer Class The Timer class of the javax.swing package is a GUI component, but it has no visual representation A Timer object generates an action event at specified intervals Timers can be used to manage any events that are based on a timed interval, such as an animation To create the illusion of movement, we use a timer to change the scene after an appropriate delay
© 2004 Pearson Addison-Wesley. All rights reserved2-13 The Timer Class The start and stop methods of the Timer class start and stop the timer The delay can be set using the Timer constructor or using the setDelay method See Rebound.java (page 471) Rebound.java See ReboundPanel.java (page 472) ReboundPanel.java
Chapter 9 Polymorphism References Java Software Solutions,” by Lewis & Loftus Chapter 7 Chapter 8 Chapter 9 Java Foundations-Introduction to Program Design & Data Structures,” by Lewis, DePasquale, and Chase Chapter 6
© 2004 Pearson Addison-Wesley. All rights reserved2-15 Outline File Choosers and Color Choosers
© 2004 Pearson Addison-Wesley. All rights reserved2-16 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
© 2004 Pearson Addison-Wesley. All rights reserved2-17 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 516) DisplayFile.java
© 2004 Pearson Addison-Wesley. All rights reserved2-18 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 519) DisplayColor.java
Chapter 6 Graphical User Interfaces References Java Software Solutions,” by Lewis & Loftus Chapter 7 Chapter 8 Chapter 9 Java Foundations-Introduction to Program Design & Data Structures,” by Lewis, DePasquale, and Chase Chapter 6
© 2004 Pearson Addison-Wesley. All rights reserved – Tool Tips A tool tip is a short line of text that appears over a component when the mouse cursor is rested momentarily on top of the component Tool tips usually inform the user about the component Tool tips can be assigned by using the setToolTipText method of a component JButton button = new Button (“Compute”); button.setToolTipText (“Calculates the area under the curve”);
© 2004 Pearson Addison-Wesley. All rights reserved – Mnemonics (1) A mnemonic is a character that allows the user to push a button or make a menu choice using the keyboard in addition to the mouse For example, when a mnemonic has been defined for a button, the user can hold down the Alt key and press the mnemonic character to activate (depress) the button Mnemonic character ‘f’ set for the Off button
© 2004 Pearson Addison-Wesley. All rights reserved – Mnemonics (2) We set the mnemonic for a component using the setMnemonic method of the component Once set, a character in the label will be underlined to indicate that it can be used as a shortcut JButton button = new Button (“Off”); button.setMnemonic (“f”); Mnemonic character ‘f’ set for the Off button
Interaction Design: Visio. About MS Visio MS Visio is a tool that allows you map user workflows, website sitemaps, website pages, software screens, forms,
1 WINDOWS BASICS Prof. Yitzchak Rosenthal. 2 Mouse terminology Cursor: –Picture on screen that moves when you move the mouse. Used to point to items on.
MS Word BasicTraining. Section One: Word Basics Section Objectives Know how to open MS Word. Be able to identify the Toolbar. Know which Tabs on.
XP New Perspectives on Microsoft Office Word 2003 Tutorial 9 1 Microsoft Office Word 2003 Tutorial 9 – Creating On-Screen Forms Using Advanced Table Techniques.
Chapter 10—Event-driven Programs The Art and Science of An Introduction to Computer Science ERIC S. ROBERTS Java Event-driven Programs C H A P T E R 1.
BTEC 149. Windows Desktop Click on the Start Button.
Microsoft Office 2007-Illustrated Introductory, Windows Vista Edition Windows XP Unit A.
Key Applications Module Lesson 11 Using Microsoft Office 2003 Computer Literacy BASICS.
Section Goals Understand Tables Know how to create, edit, and use Tables Investigate ‘nesting’ Tables Be able to format Tables.
Machine Parts and Related Terms. monitor The TV-like piece of equipment used to display text, data, and graphic images on screen.
WINDOWS XP BACKNEXTEND 1-1 Microsoft®. WINDOWS XP BACKNEXTEND 1-2 Operating System Operating systems software –The operating system is a special type.
Universal Access on Mac OS X Computer Access for Individuals with Disabilities.
Copyright All Rights Reserved 1 Chapter 3 WIMP 3.1 Definitions 3.2 Alternative Expansions Window(s) Icon(s) Menu(s) Advantages.
ENGT 122 – CAD I CAD I – Outline & Chapter 1 – Intro to AutoCAD & Chapter 2 – Getting Started with Auto-CAD.
Working with Microsoft Excel 2010 Lesson 3. Objectives.
Ambition in Action Hot Topic: Windows 7 Trainer: Michael Philipou.
Windows Basics: The Mouse. The Mouse Before you can explore the Desktop and Taskbar, you must know how to use your mouse. Your mouse is a pointing device.
1 Microsoft Office 2010 Basics and the Internet Microsoft Office 2010 Introductory Pasewark & Pasewark.
Paragraph Formatting Lesson 4. Objectives Software Orientation The Paragraph dialog box contains Words commands for changing paragraph alignment, indentation,
OSMOSiS S.C. Systems Limited. OSMOSiS What is OSMOSiS ? The OSMOSiS software suite is a complete environment for creating and managing comprehensive.
Step-by-Step: Add a Graphical Hyperlink USE the Special Events Final presentation that is still open from the previous exercise. 1.Go to slide 4, and click.
Introducing Windows 7. Start Windows and view the desktop Use pointing devices Use the Start button Use the taskbar Work with windows Microsoft Windows.
4Left Click on Start 4Slide up to Programs 4Slide right and highlight Microsoft PowerPoint Left Click.
SAPScript Forms. SAPScript Form Components SAPScript Form Components A form of the graphical Form Painter consists of five components. In alphanumeric.
Using Microsoft PowerPoint in the Classroom Joe Hill Rockingham County Public Schools.
Event handling and listeners What is an event? user actions and context event sources and listeners Why should my programs be event- driven? User interaction.
Introduction to the Mac user-interface The Mac user interface is subtly different from the Microsoft Windows interface So we will spend a few minutes pointing.
Computer Literacy BASICS: A Comprehensive Guide to IC 3, 4 th Edition Lesson 12 Getting Started with Word Essentials 1 Morrison / Wells.
T/HIS 9.2. back to contents Contents Principles of T/HIS User Interface Shortcut keys Reading LS-DYNA results files Reading data from other sources The.
Arturo Saracho CANoe Basic Training Arturo Saracho.
© 2016 SlidePlayer.com Inc. All rights reserved.