Java Look-and-Feel Design Guidelines Eileen Kraemer University of Georgia CSCI 4800/600
An online book …
- The Java Look-and-Feel Design Guidelines, Second Edition are available online
- the designer who chooses the interface elements, lays them out in a set of components, and designs the user interaction model for an application
Focus of the book ….
- design guidelines for software that uses the Swing classes together with the Java look and feel.
- on creating cross-platform GUI (graphical user interface) applications and applets in the JavaTM programming language.
- on design issues and human-computer interaction in the context of the Java look and feel.
- guidelines are appropriate for GUI applications and applets on PCs and network computers; doesn’t address the problem of S/W that runs on consumer electronic devices.
What is the “Java Look and Feel”?
- First of all, what is a “look-and-feel”?
- The appearance and behavior of a complete set of GUI components.
- Why do we need a Java look-and-feel?
- Want to have Java applications that have a consistent look and behavior across multiple platforms
- The goal of the Java look-and-feel is to provide a distinctive platform-independent appearance and standard behavior.
- surfaces appear to be in the same plane as the surrounding canvas
Elements of the Java L&F
- Style of use/appearance of:
Java L&F Windows
- Platform-specific borders, title bar, and window controls
- “Metal” look and feel window contents – menu bar, toolbar, editor pane, etc.
Menus, the Menu Bar
- Provide access to and info about application’s primary functions
- Later: guidelines for creation of such menus
- Menu separators divide choices into logical groupings
- Titles highlighted in blue (default Java look and feel theme)
- Can use keyboard shortcuts instead of the mouse.
- Mnemonics – another way to access menu items..
- keystroke combinations that activate a menu item from the keyboard even if the menu for that command is not currently displayed.
- usually consist of a modifier key and a character key, like Control-Z, plus a few special keys such as F1 and Delete.
- Don’t post menus; rather, perform the indicated actions directly.
- an underlined alphanumeric character in a menu title, menu item, or other interface component.
- reminds the user how to activate the equivalent command by simultaneously pressing the Alt key and the character key that corresponds to the underlined letter or numeral.
- See example code for both shortcuts and mnemonics
Guidelines for shortcuts …
- Specify keyboard shortcuts for frequently used menu items; don’t need a shortcut for every command
- Display shortcuts using the standard abbreviations for key names (such as Ctrl for the Control key), separated by hyphens.
- Know the common shortcuts across platforms; use them.
- Don’t use the Meta key (the Command key on the Macintosh platform) for a shortcut, except as an alternate for Control. It isn’t available on some target platforms.
Java L&F Toolbar
- displays command and toggle buttons that offer immediate access to the functions of many menu items.
- divided into functional areas
Java L&F Editor Pane
- Editor pane inside a scroll pane
Java L&F Dialog Boxes
- use the borders and title bars of the platform they are running on
- dialog box contents have the Java look and feel
Java L&F Alert boxes
Java Foundation Classes
- An extension to the original Abstract Window Toolkit ( AWT ),
- the Swing classes , which define a complete set of GUI components for JFC applications
- pluggable look and feel designs
- the Java Accessibility API,
- all implemented without native code (code that refers to the functions of a specific operating system or is compiled for a specific processor).
- windows and frames, panels and panes, dialog boxes, menus and toolbars, buttons, sliders, combo boxes, text components, tables, list components, and trees.
The Java 2 SDK
- the class library that provides the standard application programming interfaces for building GUIs for Java programs.
- Contains a JFC that also includes
Support for Accessibility
- features of the Java 2 SDK that support people with special needs:
- the Java Accessibility API
- provides “hooks” for an assistive technology to interact and communicate with JFC components ( screen readers and screen magnifiers.)
- the Java Accessibility Utilities
- provides support in locating the objects that implement the Java Accessibility API. (These utilities are necessary for developers who develop only assistive technologies, not mainstream applications.)
- keyboard navigation, mnemonics, keyboard shortcuts (also called "accelerators"), customizable colors and fonts, and dynamic GUI layout.
- A “pluggable” look and feel architecture that can be used to build both visual and nonvisual designs, such as audio and tactile UIs
- enables users to use the keyboard to move between components, open menus, highlight text, and so on.
- makes an application accessible to people who find it difficult or impossible to use a mouse.
Support for Internationalization
- J2SDK provides internationalized text handling and resource bundles.
- support for the bidirectional display of text lines
- support for localized numbers, dates, times, and messages.
User Interface Components of the JFC
- Swing, a complete set of user interface components, including windows, dialog boxes, alert boxes, panels and panes, and basic controls.
- Each JFC component contains
- a model (the data structure)
- a user interface (the presentation and behavior of the component)
Major JFC UI Components
Java L&F - Recommendations
- Don’t specify look and feel explicity.
- cross-platform l&f allows app to appear and perform the same everywhere
- simplifies the app's development and doc
- Java look and feel is used by default.
- If error occurs while specifying name of any l&f, the Java l&f is used by default.
- Available Look and Feel Designs: