200 likes | 593 Views
Applied HCI Week Six Mice in Space Overview Announcements ACM Meeting February 22 Women’s Basketball Pass out attendance roll Questions regarding Project 3 Lecture on Mouse events Critique and Lab time. Mouse Events In Spatial GUIs Spatial Interfaces Summary of Mouse Events
E N D
Applied HCI Week Six Mice in Space
Overview • Announcements • ACM Meeting February 22 • Women’s Basketball • Pass out attendance roll • Questions regarding Project 3 • Lecture on Mouse events • Critique and Lab time.
Mouse Events In Spatial GUIs • Spatial Interfaces • Summary of Mouse Events • Mouse Clicking Modifiers • Some Important Mouse Event Tips • Contextual Events in a Spatial GUI • Creating an Event Plan • Communication Among Events
Spatial Interfaces • Spatial interfaces rely mostly on mouse events, not on the keyboard input. Hybrid Interfaces will rely on both mouse and keyboard input. • In this course, mouse events may be thought of equally as: • mouse • trackball • touchpad • touch screen • etc.
Summary of Mouse Events All of the actions below are reported as MouseEvents via a MouseListener or a MouseMotionListener • The primary event methods detected for a MouseListener are: • mouseClicked • mousePressed • mouseReleased • mouseEntered (when a mouse enters a component) • mouseExited (when the mouse exits a component) • The primary event methods detected for a MouseMotionListener are: • mouseDragged (mouse moving with a button pressed) • mouseMoved (mouse moving with no buttons pressed)
Mouse Clicking Modifiers Mouse clicks may be further modified: • * verify on your own system • * * Caution these clicks require keyboard input which may cause a cognitive interrupt
Sample of Java Code to Determine Which Button Was Clicked private void formMousePressed(java.awt.event.MouseEvent evt) { if (evt.getButton() == 1) { processLeftButton(evt); // button 1 } else { processRightButton(evt); // button 3 } } Alternatively you may use: (evt.getModifiers() == InputEvent.BUTTON1_MASK)
Sample of Java Code to Determine if Shift Key and Mouse Clicked private void formMouseClicked(java.awt.event.MouseEvent evt) { if (evt.isShiftDown()) { … }
Some Important Mouse Event Tips • The location of Mouse Listeners handler is important! Place the listener in the JPanel you wish to work in, as the x and y coordinates will be relative to that panel. • Use the mousePressed method to determine where you are and what you are doing. For example, if you are inside a component you should determine which component your in within the mousePressed method. • Use the mouseDragged method to either move an object or “drag” a line. • Use the mouseReleased method to determine what you wish to do when you have completed your mouse action
Contextual Events in a Spatial GUI • Mouse events are usually contextual in spatial environments. That is, they may have different meanings depending on the context in which the event occurs. • Examples of contexts include: • clicking in a component may mean I wish to: • modify a component • delete a component • move a component • connect two components (via a connector) • clicking outside a component may mean I wish to create a new component at this location
Contextual Events in a Spatial GUI • Other ways of determining the context include: • the type of button clicked (e.g. left/right buttons, single/multiple clicks, key + click) • via items selected elsewhere in the GUI environment (e.g. the type of component you wish to create).
Contextual Events in a Spatial GUI • Caution: selecting the type of contexts is crucial to successful event handling and is not trivial. The contexts must be kept straight, as there may be competing contexts at play
Contextual Events in a Spatial GUI Best approach is to: • Prior to coding, construct an event plan: • Identify the contexts (and their triggering events). • Anticipate as many conflicts as possible. • During coding: • Try to incrementally develop the event handlers (e.g. work with components prior to working on connectors) • Test as you go! (Do NOT try to do this all at once!)
Event Plan • *if components or connectors are handled separately by type, you should create additional columns • Please note there is no retrieve in this CRUD interface since it is assumed that the components will be retrieved and visible.
Communication Among Events It is important to communicate between the events. This may be accomplished by way of signals or booleans.
Mouse Events In Spatial GUIs • Spatial Interfaces • Summary of Mouse Events • Mouse Clicking Modifiers • Some Important Mouse Event Tips • Contextual Events in a Spatial GUI • Creating an Event Plan • Communication Among Events
Project Critiques • Please do not underestimate the importance of these critique sessions!!! • Be prepared! Have your project ready for usability testing prior to turn in. • Have your partner go through an entire set of predetermined tasks as set up by you. (e.g. create, retrieve, update, and delete). Use the assignment specs as a guide, but don’t be afraid to augment with additional tests to suit your additional features.
Project Developer’s Responsibilities • When your partner runs your project, watch what he/she does. Take notes, but do not interfere, unless help is requested or required. Does your partner: • Get excited? • Get confused? • Struggle with a task? • Know exactly what to do?
User’s Responsibilities • Be prepared to test the entire project. • Give it an honest try, but do not bend over backwards to make the project work. If the interface is not intuitive or straightforward, help your partner by letting him/her know. • Don’t be insulting but don’t hold back either.
Applied HCI Week Six Mice in Space