200 likes | 311 Views
Introduction. CMPT 381. Outline. The interaction cycle Parts of a Graphical User Interface A layered approach to supporting interaction. The Interaction Cycle. architecture of interactive systems. the human. the system. view. mental model. present. perceive. notify. model. express.
E N D
Introduction CMPT 381
Outline • The interaction cycle • Parts of a Graphical User Interface • A layered approach to supporting interaction
architecture of interactive systems the human the system view mental model present perceive notify model express translate change controller the interface
Example: software thermostat view view mental model mental model Too cold, move to half way present notify notify Value changed Redraw slider model model Max = 250 Min = 160 Temp = 200 express express translate translate Mouse movement Watch mouse change change controller control Change temp. from 20 to 22
Parts of a GUI • Input side: • Input devices • Device drivers • Device interfaces • Window management • Input events • Output side: • Interface widgets • Graphics & sound • Display/output devices
Parts of a GUI • Input side: • Input devices • Device drivers • Device interfaces • Window management • Input events • Output side: • Interface widgets • Graphics & sound • Display/output devices UI Toolkit
Layered Approach Display Output Application UI Toolkit Windowing System Operating System Devices User Input
Layered Approach • Device layer • Hardware level for input and output devices • Device drivers communicate with the OS • OS layer • Turns input signals into events and sends to applications • Provides graphics/sound API • low-level machine-optimized drawing routines • e.g. Windows API, Macintosh Toolbox, X Intrinsics
Layered Approach • Windowing system layer • puts applications in separate windows • handles resize, close, and iconify events • enforces a presentation style • UI Toolkit layer • provides a set of high-level interface components • in Java, called the Abstract Windowing Toolkit (AWT) • in Tcl/Tk, called Tk • Handles incoming events • provides support for widget layout and graphics
Layered Approach • Application layer • decides what to do with user input • manipulates the UI widgets • controls custom repainting of the screen • The programmer only has to deal with the application and toolkit layers
Layered Approach • The layers are much the same whether you’re building for the desktop, amobile device, or a wall display • The specifics capabilities of the UI toolkit will be different, but the basic ideas are similar
Window System • Controls mouse, keyboard, monitor settings • Provides windows for applications • Keeps a map of what application is where • Dispatches input to different windows • Uses the map to decide who to inform
Window Manager • Controls how windows look and act • Window decoration, Title bar • Window switching, virtual desktops • (Note that a ‘Desktop Environment’ is not the same as the WM; it is an application) • Microsoft Windows: • Combines OS, Window System, Window Manager, and Desktop Environment
Olivier Chapuis and Nicolas Roussel • Metisse • http://insitu.lri.fr/~roussel/videos/metisse/metisse/metisse.mov • Compiz Fusion • http://semicolons.org/post/271696242/compiz-fusion
Hello World in Java/Swing import javax.swing.*; public class HelloWorldSwing { private static void createAndShowGUI() { JFrame frame = new JFrame("HelloWorldSwing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("Hello World"); frame.getContentPane().add(label); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater( new Runnable() { public void run() { createAndShowGUI(); } }); } }
Hello World in Tcl/Tk label .hi –text “Hello” pack .hi
Homework • Work with your three environments • Online tutorials, e-books from U of S library • Textbook: • Chapter 1 (overview) • Chapter 4 (widgets)