Presentation is loading. Please wait.

Presentation is loading. Please wait.

Example Program DemoLowLevelEvents.java DemoHighLevelEvents.java

Similar presentations


Presentation on theme: "Example Program DemoLowLevelEvents.java DemoHighLevelEvents.java"— Presentation transcript:

1 Example Program DemoLowLevelEvents.java DemoHighLevelEvents.java
Sep 25

2 Example Program DemoActionEvents.java DemoFocusEvents.java Sep 25

3 Basic Widgets GUI goo

4 Outline What is a widget? Buttons Combo boxes Text components
Message boxes Sep 25

5 What is a Widget? Widgets are interactive objects - the basic building blocks of graphical user interfaces Generally meant to metaphorically suggest real-world controls. Examples: buttons, menus, scrollbars. More complex examples: windows or dialog boxes which also contains other widgets Widgets have some behaviour: they respond to input and they change what they're displaying. Used for both input and output Input - information and commands Output - information and application status Sep 25

6 Widgets User interface toolkits (such as Swing) provide programmers with easy ways to display and use widgets and sometimes to design their own widgets. An important part of user interface design is choosing and laying out widgets on the screen Widgets are the most obvious visual contribution of GUIs. They're ideally intuitive. They're fun. They're familiar. They occur again and again so users become accustomed to using them. Sep 25

7 Outline What is a widget? Buttons Text components Combo boxes
Message boxes Sep 25

8 What is a Button? An individual and isolated region of a display that can be selected by the user to invoke a state or command Designed to look like physical buttons to suggest they can be “pushed” (like physical buttons) Four types Push buttons - invoke a command Radio buttons - enable a state and indirectly disable one or more other states Checkboxes - toggle a state on/off Modal buttons – hybrid of push button and checkbox (aka toggle buttons) Sep 25

9 Push Buttons The most common type of button
Pushed (“clicked”) to invoke a command Three ways to organize push buttons… Isolated An individual button in a window Pushed (“clicked”) to invoke a command (e.g., Cancel, OK, Close, Preview) Menus A menu is simply a popup collection of buttons Toolbars A collection of buttons with commonly used functions Presentation is “persistent” (rather than popup, as with menus) Usually employ a small icon, rather than text Sep 25

10 Push Button Examples Isolated Menu Toolbar Push button Push button
Sep 25

11 Radio Buttons Allow a user to select one feature from a set of mutually exclusive features Name derived from radio station selector buttons Sep 25

12 Radio Button Example Three mutually-exclusive options Sep 25

13 Checkboxes “Checked” to turn a state on/off When to use checkboxes
When a feature or characteristic has precisely two states and these are appropriately described as being “enabled” or “on” vs. “disabled” or “off” (e.g., lightbulb = on | off) When not to use checkboxes When a feature or characteristic has more than two states (e.g., season = spring | summer | autumn | winter) When enabled/on and disabled/off are inappropriate descriptions of the states (e.g., gender = male | female) Sep 25

14 Checkbox Example Checked = Enable “show windows in taskbar”
Unchecked = Disable “show windows in taskbar” Sep 25

15 Modal Buttons A hybrid of push buttons and checkboxes A modal button…
Looks like a push button Toggles a state Text or icon in button indicates the next state E.g., “show details” vs. “hide details” Sep 25

16 JRadioButtonMenuItem
Java’s Button Classes AbstractButton JButton JCheckBoxMenuItem JRadioButtonMenuItem JToggleButton JCheckBox JRadioButton Sep 25


Download ppt "Example Program DemoLowLevelEvents.java DemoHighLevelEvents.java"

Similar presentations


Ads by Google