CS415 Human Computer Interaction

Similar documents
CS415 Human Computer Interaction

CS415 Human Computer Interaction

SE310 Analysis and Design of Software

CEC450 Real-Time Systems

CS415 Human Computer Interaction

Graphical User Interfaces (GUIs)

SE310 Analysis and Design of Software Systems

CS415 Human Computer Interaction

Swing from A to Z Some Simple Components. Preface

SE300 SWE Practices. Lecture 10 Introduction to Event- Driven Architectures. Tuesday, March 17, Sam Siewert

SE310 Analysis and Design of Software Systems

SE310 Analysis and Design of Software Systems

MIT AITI Swing Event Model Lecture 17

Programming Language Concepts: Lecture 8

SINGLE EVENT HANDLING

Building a GUI in Java with Swing. CITS1001 extension notes Rachel Cardell-Oliver

RAIK 183H Examination 2 Solution. November 10, 2014

RAIK 183H Examination 2 Solution. November 11, 2013

State Application Using MVC

Frames, GUI and events. Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling

SE310 Analysis and Design of Software Systems

Original GUIs. IntroGUI 1

The JFrame Class Frame Windows GRAPHICAL USER INTERFACES. Five steps to displaying a frame: 1) Construct an object of the JFrame class

Object-Oriented Programming: Revision. Revision / Graphics / Subversion. Ewan Klein. Inf1 :: 2008/09

Control Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User

Come & Join Us at VUSTUDENTS.net

Swing: Building GUIs in Java

CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1

Swing: Building GUIs in Java

First Name: AITI 2004: Exam 2 July 19, 2004

Midterm assessment - MAKEUP Fall 2010

DEMYSTIFYING PROGRAMMING: CHAPTER SIX METHODS (TOC DETAILED) CHAPTER SIX: METHODS 1

CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming

Queens College, CUNY Department of Computer Science. CS 212 Object-Oriented Programming in Java Practice Exam 2. CS 212 Exam 2 Study Guide

Introduction to the JAVA UI classes Advanced HCI IAT351

Swing from A to Z Using Focus in Swing, Part 2. Preface

Command-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages.

Lecture 5: Java Graphics

CS317 File and Database Systems

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more

Topic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun!

We are on the GUI fast track path

Multithreading and Interactive Programs

CSCI 136 Written Exam #2 Fundamentals of Computer Science II Spring 2012

First Name: AITI 2004: Exam 2 July 19, 2004

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7

COMP-202 Unit 10: Basics of GUI Programming (Non examinable) (Caveat: Dan is not an expert in GUI programming, so don't take this for gospel :) )

CSE wi Final Exam 3/12/18. Name UW ID#

Review sheet for Final Exam (List of objectives for this course)

International Journal of Current Research and Modern Education (IJCRME) ISSN (Online): ( Volume I, Issue II, 2016

Virtualians.ning.pk. 2 - Java program code is compiled into form called 1. Machine code 2. native Code 3. Byte Code (From Lectuer # 2) 4.

CS Exam 1 Review Suggestions

Graphical User Interface (Part-1) Supplementary Material for CPSC 233

ITEC 120 4/14/11. Review. Need. Objectives. GUI basics JFrame JPanel JLabel, JButton, JTextField Layout managers. Lecture 38 GUI Interactivity

Packages: Putting Classes Together

Distributed Collaboration - Assignment 1: Multi-View 1-User IM

Lab & Assignment 1. Lecture 3: ArrayList & Standard Java Graphics. Random Number Generator. Read Lab & Assignment Before Lab Wednesday!

Interface Implementation

Programming Languages and Techniques (CIS120)

KF5008 Program Design & Development. Lecture 1 Usability GUI Design and Implementation

Lab 4. D0010E Object-Oriented Programming and Design. Today s lecture. GUI programming in

Lecture 3: Java Graphics & Events

Designing Interactive Systems II

Lesson 2: First Java Programs

Review. Designing Interactive Systems II. Introduction. Web 2.0 in keywords GWT Cappuccino HTML5. Cross platform GUI Toolkit

Graphical User Interfaces

Example: CharCheck. That s It??! What do you imagine happens after main() finishes?

Graphics User Defined Forms, Part I

Window Interfaces Using Swing Objects

Chapter 13 Lab Advanced GUI Applications

H212 Introduction to Software Systems Honors

EPITA Première Année Cycle Ingénieur. Atelier Java - J5

University of Cape Town ~ Department of Computer Science. Computer Science 1016S / 1011H ~ November Exam

AP CS Unit 11: Graphics and Events

Window Interfaces Using Swing Objects

MVC: Model View Controller

Systems Programming Graphical User Interfaces

Graphical User Interface (GUI)

CS 4300 Computer Graphics

Core Java Syllabus. Pre-requisite / Target Audience: C language skills (Good to Have)

DM503 Programming B. Peter Schneider-Kamp.

CS 11 java track: lecture 3

CSE 331 Software Design & Implementation

Eclipsing Your IDE. Figure 1 The first Eclipse screen.

What we saw. Desarrollo de Aplicaciones en Red. 1. OS Design. 2. Service description. 1.1 Operating System Service (1)

Java Programming Lecture 6

CS180 Spring 2010 Exam 2 Solutions, 29 March, 2010 Prof. Chris Clifton

Introduction. Introduction

ASSIGNMENT NO 14. Objectives: To learn and demonstrated use of applet and swing components

Introduction to Graphical User Interfaces (GUIs) Lecture 10 CS2110 Fall 2008

Introduction to Java. Lecture 1 COP 3252 Summer May 16, 2017

Introduction to Java Programming

CPS221 Lecture: Threads

Part I: Learn Common Graphics Components

Beyond CSE143. What s Left To Do? Templates. Using Templates. A Template Class. A Problem with Reusing Code CSE 143

CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2015

Handouts. 1 Handout for today! Recap. Homework #2 feedback. Last Time. What did you think? HW3a: ThreadBank. Today. Small assignment.

Chapter 13 Lab Advanced GUI Applications Lab Objectives. Introduction. Task #1 Creating a Menu with Submenus

SE310 Analysis and Design of Software Systems

Introduction to Graphical Interface Programming in Java. Introduction to AWT and Swing

Transcription:

CS415 Human Computer Interaction Lecture 3 WIMP HCI (GUI Builders Part-2) September 7, 2018 Sam Siewert

Recall - GUI Layout & Code-Gen or VHLLs for GUI Build Method #1 Compiled Programming Language (e.g. C/C++) and Widget Libraries (e.g. X-windows Gnome, KDE, etc. or Windows) Advantages Compiled for Efficiency, Security, Proprietary IP Protection (Stripped Binaries) Disadvantages Less Interactive Development: Layout, Generate code, Compile, Test, Repeat Method #2 Interpreted Very High Level Language (e.g. Java, Python, C# (both with Common Language Infrastructure)) Advantages Interpreted for Quick Test as you Code (Agile), Rapid Prototyping, Portability Disadvantages Security Risks in Runtime (Java Virtual Machine, CLI) Sam Siewert 2

Installed on SE Workstation (use instructions) GUI Builder Run with qtcreator (/usr/bin/qtcreator) Qt Creator View tutorials on QtCreator QtCreator for C++ [Part-1, Part-2, Part-3, Part-4, Part-5, Part-6, Part-7, Part-8] Sam Siewert 3

Python VHLL GUI Example Python has Two Major Versions 2.x and 3.x Language re-design with 3.x for better OOP Older 2.x is Somewhat OOP and Still Popular Download Python Interpreter for Windows, Mac OS-X, Linux, etc. Bound to Tk from Ancient TCL/Tk Environment for Building GUIs for Test Automation and Verification (ASIC Simulation) and Graphics/Computer-Vision Nice Rapid Prototyping Environment Examples (GeeksforGeeks calculator, TechInfected, TeamPython) Python tutorials - Python using Tk [Part-1, Part-2] Sam Siewert 4

Python - VHLL Use the IDLE Editor, CLI, or PyCharm Yes, this is a Reference to Monty Python Python CLI PRClab I used with a ASIC ARM SoC Design Group to Create an Interface for our ILA Python IDLE IDE http://www.blu-ray.com/eric-idle/68832/ 1/6 th Monty Python Comedy Group https://en.wikipedia.org/wiki/monty_python Sam Siewert 5

Python PyCharm IDE File.py is a TEXT file Use any Editor For IDE, use IDLE or PyCharm File.pyc is byte-code compiled Python 3.x For 2.x code, use File-Settings-Project-Interpreter and modify (note that we may not have 2.x packages) CLI, IDLE and PyCharm are installed in Standard Image on Campus for 2.x and 3.x PyCharm GUI Overview Sam Siewert 6

Java OOP Java Calculator Example Main program container class CalculatorGui class Public and Private classes and methods Sam Siewert 7

Java Calculator Walkthrough and Demo Import of Java Swing GUI Widget set Instantiation of Calculator GUI Main window configuration and realization import javax.swing.*; import java.awt.*; import java.awt.event.*; Main widget construction public class SwingCalculator { public static void main(string[] args) { CalculatorGui cg = new CalculatorGui(); Main widget configuration } } cg.setsize(250,400); cg.setresizable(false); cg.setdefaultcloseoperation(jframe.exit_on_close); cg.setvisible(true); Main widget realization Sam Siewert 8

import javax.swing.*; import java.awt.*; import java.awt.event.*; Deeper Dive public class CalcTemplateGui extends JFrame { JFrame frame = new JFrame("My Simple Calculator"); JTextField answerfield; JButton add, sub, div, mul, equals; JButton one, two, three, four, five, six, seven, eight, nine, zero; JPanel contentpanel; String stemp1=""; // CalculatorGui default constructor - super long constructor public CalcTemplateGui() { super("my Simple Calculator"); } private class Operations implements ActionListener { public void actionperformed(actionevent event) { JButton src = (JButton) event.getsource(); } } private class ArgumentEnter implements ActionListener { public void actionperformed(actionevent event) { JButton src = (JButton) event.getsource(); Event handler Classes for specific Active widgets 0-9 Digits and Arithmetic Operators } } } Sam Siewert 9

Connecting Buttons to Event Handlers Instantiate Handler Classes for Button Types Add Action Listener Using Swing Implement Handler Class and Detect Source // layout with specific dimension for each button one.setpreferredsize(dim); two.setpreferredsize(dim); div.setpreferredsize(dim); mul.setpreferredsize(dim); equals.setpreferredsize(dim); // create a private class to handle events detected by an action listener Operations op = new Operations(); ArgumentEnter arg = new ArgumentEnter(); // Add a listener to each button to invoke a handler for arguments entered one.addactionlistener(arg); two.addactionlistener(arg); nine.addactionlistener(arg); zero.addactionlistener(arg); // Add a different listener to each button to invoke a handler add.addactionlistener(op); sub.addactionlistener(op); div.addactionlistener(op); mul.addactionlistener(op); equals.addactionlistener(op); Sam Siewert 10

GUI Layers GUI Application Build on API or CLI Simply Generates CLI Commands or API Calls Updates Displays with Return Codes or Screen Scraped Messaging Not Always the Best Idea (but Often Done) Sam Siewert 11

Prototypes and Mock-ups Early Feedback on Look and Feel Usability Engineering Time to Complete Common Tasks Success Rate for Test Tasks by Different Users Cognitive Load for Tasks using an HCI or GUI Focus Groups for Usability Sam Siewert 12

Assignment #2 Ex #2 Designing and Prototyping Interactive WIMP Applications 1. Critique of Windows Calculator in Standard, Basic View 2. Choose and OOP and IDE for Development and Test Method #1 GUI Code Generation QtCreator for C++ Visual Studio C# with WinForm Method #2 VHLL Interactive with Libraries Python with Tk Java with Swing 3. State Machine / State-Transition Table Design 4. Prototype Event Handler Implementation Handle Errors Please! 5. Portability Demonstration for Extra Credit Sam Siewert 13

Recall Interactive Design Methods SE300 (State Machines and Activity Diagrams) Sam Siewert 14

Event-Driven and Behavioral Specification Activity Diagrams Concurrency Objects with Active Threads (Tasks) Recall activity diagrams (express concurrency) State-Machines Deterministic Response Model for a Task (Thread) Task Awaits and Activating Event and Transitions to a New Statet Recall state machines (express states and transitions) Sam Siewert 15

Activity Diagram Example Sam Siewert 16

Copyright {c} 2014 by the McGraw-Hill Companies, Inc. All rights Reserved. State Behavior Modeling State dependent behavior is common in software systems. off park fwd brake on off up down on reverse neutral released engine transmission brake What is the state dependent behavior of a car? 13-17

Copyright {c} 2014 by the McGraw-Hill Companies, Inc. All rights Reserved. Conventional State Transition Matrix 13-18

Copyright {c} 2014 by the McGraw-Hill Companies, Inc. All rights Reserved. Real Time Systems Design transformational processes, representing computations or information processing activities control processes, representing system s state dependent behavior, which is modeled by a Mealy type state machine continuous data flow, which must be processed in real time ordinary or discrete data flow event flow or control flow that triggers a transition of the state machine of a control process, or a command from a control process to a transformational process 13-19

Copyright {c} 2014 by the McGraw-Hill Companies, Inc. All rights Reserved. Real Time Systems Design a b P indicates that both data flow a and data flow b are required to begin executing process P a + b P indicates that either data flow a or data flow b is required to begin executing process P These logical connector can be applied to both data flow and control flow and transformation process and control process. 13-20

Copyright {c} 2014 by the McGraw-Hill Companies, Inc. All rights Reserved. Z Z X Y Real Time Systems Design Two subsets of Z are used by two different successor processes. All of Z is used by two different successor processes. X Y Z Z is composed of Two subsets provided by two different predecessor processes. Z All of Z is provided by either one of two predecessor processes. 13-21

Copyright {c} 2014 by the McGraw-Hill Companies, Inc. All rights Reserved. Cruise Control Example enable/disable rotation rate throttle control start/stop increase speed Increase Speed 2.2.3 throttle position brake enable/ disable throttle control Cruise Control 2.2.1 resume trigger enable/ disable enable/ disable Maintain Constant Speed 2.2.4 rotation rate speed reached throttle position Record Rotation Rate 2.2.2 Return to Previous Speed 2.2.5 rotation rate set point rotation rate throttle control rotation rate throttle position 13-22

Cruise Control State Machine enable[] / trigger RRR; enable MCS disable[] / disable MCS Maintain Speed brake[] / disable MCS start increase speed[] / disable MCS; enable IS stop increasing speed[] / disable IS; trigger RRR; enable MCS Increase Speed brake[] / disable IS Interrupted resume[] / enable RPS brake[] / disable RPS speed reached[] / disable RPS; enable MCS Resume Speed Sam Siewert 23

Copyright {c} 2014 by the McGraw-Hill Companies, Inc. All rights Reserved. State Transition Table State stubs show the states. Component substate State & Substate S 1 S 2 S 3 S4 (init) S5 S6 (init) E1 E2 E3 Event stubs list the events. A single-line separates specialization substates A double-line separates component substates Specialization substate S8 S7 S9 SA NA S9 S6 [C] / a1; a2 Transition entry, which means: if object is in S7 and E3 occurs and condition C is true, then actions a1 and a2 are executed and object enters S6. Table entry: initially all are. Eventually, each should be NA, or a transition entry. 13-24

Copyright {c} 2014 by the McGraw-Hill Companies, Inc. All rights Reserved. Cruise Control State Transition Table 13-25

Copyright {c} 2014 by the McGraw-Hill Companies, Inc. All rights Reserved. Conventional State Transition Matrix 13-26

Clarifications on State Machines Object State Modeling Event-Driven Collecting and Classifying State Behavior http://en.wikipedia.org/wiki/uml_state_machine Extensions to Domain Models [Class Diagram and OIM] to add Domain State Machine Model For Event-Driven Architectures or Architectures with Event- Driven Aspects and Subsystems, EFSMs are High-Level (Domain) http://en.wikipedia.org/wiki/specification_and_description_language SDL FYI Not on Exam(s) State Transition Tables UML Notation event[guard] / act1; act2 Cruise Control Sam Siewert 27

Clarifications on Activity Diagrams Activity Models Concurrency, Fork, Join for Tasks http://www.holub.com/goodies/uml/ Task Could Be Implemented as Linux Process, POSIX Thread, VxWorks Task, Unix/Windows Service, etc. Petri-Net Formalism, Can Be Simulated and Used for Cleanroom CFD/DFD UML Activity Diagram Notation Activity Table - Analysis Sam Siewert 28