1CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. Lecture 10: Windows & Layout.

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming
Advertisements

Paragraph Formatting Lesson 4.
Chapter 3 – Web Design Tables & Page Layout
Graphic User Interfaces Layout Managers Event Handling.
Chapter 3 Creating a Business Letter with a Letterhead and Table
CMSC 341 Building Java GUIs. 09/26/2007 CMSC 341 GUI 2 Why Java GUI Development? Course is about Data Structures, not GUIs. We are giving you the opportunity.
1 Windows CIS*2450 Advancing Computing Techniques.
Corresponds with Chapter 12
Lesson 2 — Working with Text
Event Driven Programming and GUIs Part 3 CS221 – 4/15/09.
1.
Java Swing Toolkit Graphics The key to effectively using graphics in Java is understanding: –the basic components of the graphics library –the patterns.
Understanding SWING Architecture CS 4170 UI Design Hrvoje Benko Oct. 9, 2001.
Flowchart Start Input weight and height
Lecture 15 Graphical User Interfaces (GUI’s). Objectives Provide a general set of concepts for GUI’s Layout manager GUI components GUI Design Guidelines.
Swing CS-328 Dick Steflik John Margulies. Swing vs AWT AWT is Java’s original set of classes for building GUIs Uses peer components of the OS; heavyweight.
Using HTML Tables.
1 GUI Elements in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
GUI Layout Managers Arkadiusz Edward Komenda. Outline Components and Containers Layout Managers Flow Layout Grid Layout Border Layout Nested Containers.
PowerPoint: Tables Computer Information Technology Section 5-11 Some text and examples used with permission from: Note: We are.
With Alex Conger – President of Webmajik.com FrontPage 2002 Level I (Intro & Training) FrontPage 2002 Level I (Intro & Training)
CHAPTER 11 Tables. How Are Tables Used Data Display  Very tidy and very useful Better Text Alignment  Putting text in tables allows you to format indents.
Java Look-and-Feel Design Guidelines – Visual Design Eileen Kraemer University of Georgia CSCI 4800/600.
MICROSOFT WORD GETTING STARTED WITH WORD. CONTENTS 1.STARTING THE PROGRAMSTARTING THE PROGRAM 2.BASIC TEXT EDITINGBASIC TEXT EDITING 3.SAVING A DOCUMENTSAVING.
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
Java Programming: From Problem Analysis to Program Design, 4e Chapter 12 Advanced GUIs and Graphics.
Microsoft Word 2000 Presentation 5. Major Word Topics Columns Tables Lists.
Adobe Dreamweaver CS3 Revealed CHAPTER FIVE: USING HTML TABLES TO LAY OUT A PAGE.
CIS 068 Welcome to CIS 083 ! Introduction to GUIs: JAVA Swing.
Introduction to GUI in Java 1. Graphical User Interface Java is equipped with many powerful,easy to use GUI component such as input and output dialog.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 2 Creating a User Interface.
Paragraph Formatting Lesson 4.
Domain 3 Understanding the Adobe Dreamweaver CS5 Interface.
3461A Readings from the Swing Tutorial. 3461A Overview  The follow is the Table of Contents from the trail “Creating a GUI with JFC/Swing” in the “The.
Java Programming: Advanced Topics 1 Common Elements of Graphical User Interfaces Chapter 6.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 14 Tables.
 Definition  Components  Advantages  Limitations Contents  Introduction Introduction  Inserting a Table Inserting a Table  Drawing a Table Drawing.
Graphics and Event-Driven Programming in Java John C. Ramirez Department of Computer Science University of Pittsburgh.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 15 Advanced Tables.
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.
ITEC 109 Lecture 27 GUI. GUIs Review Sounds –Arrays hold sample values –Creating a keyboard –Sound effects Homework 3 –The big two –Due after break –Lab.
Chapter 4 Working with Frames. Align and distribute objects on a page Stack and layer objects Work with graphics frames Work with text frames Chapter.
1 Java Swing - Lecture 2 Components and Containment Boriana Koleva
Object Oriented Programming Engr. M. Fahad Khan Lecturer, Software Engineering Department University of Engineering & Technology, Taxila.
Java Applets: GUI Components, Events, Etc. Ralph Westfall June, 2010.
GUI Basics. What is GUI? A graphical user interface (GUI) is a type of user interface item that allows people to interact with programs in more ways than.
Chapter 3 ADOBE INDESIGN CS3 Chapter 3 SETTING UP A DOCUMENT.
SEEM3460 Tutorial GUI in Java. Some Basic GUI Terms Component (Control in some languages) the basic GUI unit something visible something that user can.
© 2010 Delmar, Cengage Learning Chapter 4 Working with Frames.
Lesson 6 Formatting Cells and Ranges. Objectives:  Insert and delete cells  Manually format cell contents  Copy cell formatting with the Format Painter.
© 2011 Delmar, Cengage Learning Chapter 4 Working with Frames.
LECTURE 18 16/11/15. MAKING THE INTERFACE CONSISTENT Consistency is one way to develop and reinforce the users conceptual model of applications and give.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Visual Studio.NET Integrated.
Introducing Dreamweaver. Dreamweaver The web development application used to create web pages Part of the Adobe creative suite.
Positioning Objects with CSS and Tables
1CS480: Graphical User Interfaces. Dario Salvucci, Drexel University. Lecture 3: Layout Basics.
XP IT INSTRUCTOR :AHMAD HIRZALLAH 1 Microsoft Office FrontPage 2003 Creating Tables and Frames.
3461 Laying Out Components Principles of Good Screen Design Galitz, W. O., (2002) The Essential Guide to User Interface Design, 2nd Edition, Wiley Computer.
Introduction to GUI Programming in Java: Frames, Simple Components, and Layouts.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
MS WORD INFORMATION TECHNOLOGY MANAGEMENT SERVICE Training & Research Division.
Desktop Publishing Lesson 2 — Working with Text. Lesson 2 – Working with Text2 Objectives  Create a blank document.  Work with text boxes.  Work with.
Lesson 13 Tables. Overview Create a table. Key and edit text in tables. Select cells, rows, and columns. Edit table structures. Format tables and cell.
Microsoft Visual Basic 2005: Reloaded Second Edition
Chap 7. Building Java Graphical User Interfaces
Graphical User Interfaces -- Introduction
CIS16 Application Programming with Visual Basic
Creating Graphical User Interfaces
Chapter 2 – Introduction to the Visual Studio .NET IDE
Presentation transcript:

1CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. Lecture 10: Windows & Layout

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 The Rest of the Term Focus mostly on the Framework of Design Special topics, but design topics. CS Majors: Mostly the programmers, so the development end is of more use to you. Research users & the domain Modeling users & use contexts Requirements user, business, & technical needs Framework structure & flow Refinement of behavior, form, context

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Windows Windows form the basis of our GUI The 4 basic types...

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Primary windows Primary windows are handled mostly by the particular platform you’re on – OS handles title/outline, moving, resizing, etc. – Swing draws the content (assuming Metal feel) – e.g., on MS Windows...

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Typically, dialog & alert boxes – again, OS handles outside, Swing handles inside Key: dependent on primary window – if primary closes, secondary closes Secondary windows

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Typically, used to display a collection of tools, colors, or patterns Unlike secondary windows, are not dependent on primary/parent window – thus, doesn’t close when parent closes Utility windows

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Plain windows Typically, “splash screen” windows – that is, the window “announcing” the application as seen on launch – other uses?

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 window = new JFrame (); window = new JDialog (); window = new JWindow (); Creating windows What Swing classes do we use for each? – primary windows: – secondary windows: – utility windows: – plain windows: Luckily, all these behave very similarly – just create them & lay them out as usual – in a few lectures we’ll talk more about putting them all together to work smoothly – today we’ll focus on a single window

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Window visual design Say we’re designing a new window. – we know components should go in the window – but where do we put these components? We’ll rely on Java’s Human Interface Guidelines to specify how to do this – as discussed before, the guidelines aren’t perfect – but they do give us a cohesive, integrated picture all specifications go together into a unified theme think style sheets in HTML...

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Basic guidelines As a starting point, it’s good to review what we’re after in a good layout – clarity and consistency – logical grouping of related components – efficient “movement” through interface – aesthetically pleasing – flexible for all users: foreign users, users with disabilities, etc. Lets take, for example only, a Dialog box.

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Layout process (1) Determine the functional requirements for your dialog box and the type and importance of the dialog box components – example: “Find” dialog box – what information do we need? find text options: match case? whole word? – what components do we need? text box for find text check/radio buttons (etc.) for options command buttons: “Find”, “Close”

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Layout process (2) Create a window with 12-pixel margins between the border of the dialog box and its components – Include 12 pixels between the top and left borders of a dialog box and its components.

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Layout process (3) Arrange the command button row and separate it vertically from the rest of the components – Place 17 pixels of vertical space between the command button row and the other components. – Buttons must have the same width and must right-aligned along the bottom margin.

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 (We interrupt this program...) If you read the Java Human Interface Guidelines, you’ll see things like: – “Include 11 pixels between the bottom and right borders of a dialog box and its command buttons. (To the eye, the 11-pixel spacing appears to be 12 pixels because the white borders on the lower and right edges of the button components are not visually significant.)” We won’t worry about this 1 pixel. Either one is fine. What does this remind you of?

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Layout process (4) Create a design grid, using the number and width of the rest of the components to decide the number of columns and the column width for the grid. – design grid = rows & columns to structure design we’re not talking a strict grid we’re not talking GridLayout’s essentially, we’re talking guides to help with horizontal and vertical alignment

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Layout process (4) Back to our process... – design grid example for “Find” box – guidelines suggest that grid to derive from command buttons and spacing – we won’t abide by this — but having a grid roughly this size is a good idea that is, pick a grid and stick to it

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Layout process (5) Add the components to the dialog box in their logical sequence. – When designing a dialog box, place the most important options, or those you expect users to complete first, prior to others (in reading order). (6) Align related components using the design grid. – Align related components vertically using a chosen design grid column, and horizontally using a chosen design grid row.

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Labels – Place labels before the component to which they refer (generally, above and to the left.) – Align labels with the tops of their components. – Insert 12 pixels between the trailing edge of a label and any associated components. – Left-align all vertically aligned labels. Insert 12 pixels after the edge of the longest label. Component specifics

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Component specifics Command buttons – Center all button text, with a 12-pixel left & right boundary between button label and button edge. – Make all grouped command buttons equal width, which doesn’t change when window is resized. – Space buttons in a group 6 pixels apart. – Make the default button the left-most button. – Insert 17 pixels between these & rest of window

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Quick time out! Why is this a good or bad thing to do? Bad: – Glue: Resizing issues Good: – Style Guidelines

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University Component specifics Radio & check-box buttons – Align the leading edge with that of other components. – Space grouped buttons 6 pixels apart. – Space separate groups 12 pixels apart.

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Component specifics Toolbar buttons – Space individual toolbar buttons 2 pixels apart. – Space groups of toolbar buttons 11 pixels apart. – Include 3 pixels of space above and below all toolbar buttons.

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Component specifics Interface text – Most components use “headline” capitalization. [capitalize every word except articles, conjunctions, and short prepositions] Checkbox text (Automatic Save Every Five Minutes) Combo box text (Centimeters) Command button text (Don't Save) Icon names (Trash Can) Labels for buttons or controls (New Contribution To:) Menu items (Save As...) Menu titles (View) Radio button text (Start at Top) Titles of windows and dialogs (Color Chooser) Tool tips (Cut Selection)

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Component specifics Interface text (continued) – Alerts, errors, and long labels use “sentence” capitalization. [capitalize only the first word in the sentence] Alert box text (The document you are closing has unsaved changes.) Error or help messages (The printer is out of paper.) Labels that indicate changes in status (Operation is 75% complete.)

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Implementation of guidelines Not surprisingly, Swing is set up to implement the specified guidelines Some tips to help you... – hard spacing around buttons, labels, etc. – spacing around main window with border pane.add (Box.createRigidArea (new Dimension (0,5))); Border spacer = BorderFactory.createEmptyBorder (top, left, bottom, right); component.setBorder (spacer);

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Implementation of guidelines Some tips to help you... (continued) – layout managers are your friends for consistent alignment and spacing e.g., BorderLayout ‘South’ panels for command buttons e.g., GridLayout to get equal-sized command buttons

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Code structure What’s the best way to code up a window? – like design, there’s no best way really – but we’ll give you a good way Starting point: remember the model-view-controller architecture? – Swing’s components all have an implicit/explicit model separate from the view & controller – let’s say we want a window to represent some chunk of information – we want to separate the model of this information from its view & controller

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Code structure Given our chunk of information... – model = information – view & controller = component – let’s have a Java class for each part: class MyInfoWindow extends JDialog includes all window’s components class MyInfo includes all model information ModelView+Controller

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Code structure Example: Calendar “Event” Window – assume we want to add an event to a calendar – what information & components do we need? InformationComponents

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Code structure Example: Calendar “Event” Window – what Java classes do we create from this? ModelView+Controller

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Code structure Example: Calendar “Event” Window – view+controller class still needs organization — namely, how can we sketch out the window?

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.1 Code structure For window classes, we’ll follow this style... public class MyInfoWindow extends JFrame { > class > implements > { … } … MyInfoWindow (MyInfo) { super ( >); > } // for primary windows, include main()... public static void main (String s[]) { JFrame frame = new MyInfoWindow (MyInfo); > }