Title: Java Power Tools: A Foundation for Interactive GUI Exploration Viera K. Proulx, Richard Rasala, Jeff
1Java Power ToolsA Foundation for
InteractiveGUI ExplorationViera K. Proulx,
Richard Rasala, Jeff RaabHCI 2001 Conference
New Orleans, LAAugust 10, 2001www.ccs.neu.edu/t
eaching/EdGroup/JPTNSF DUE CCLI-EMD 995-0829
2GUI Design Requirements
- Easy installation of GUI components
- Recursive behavior (enable, save contents)
- Robust input processing
- Easy creation of action control gadgets
- Simple yet robust graphics support
- Easy extraction of information from views
- Easy setting of the view contents from the
program
3Benefits of easy-to-build GUIs
- Programming courses
- Focus stays on algorithmics and OO design
- GUI design process
- Focus is on users needs and expectations
- Learning and exploration
- Easy to provide multiple views of data
- Easy to provide persistent display of current
state - Easy to install controls for exploration
4Building GUI with JPT Toolkit
- GUI building (single statement each)
- Create GUI object
- Install GUI object in the display
- Extract information
- Display information
5JPT (Java Power Tools)
- String as communication medium
- Model encodes/decodes String
- View extracts/displays String
- Action button linked to action
6The Stringable Interface
- This interface applies to data models
- Data is Stringable if one can encapsulate its
state in a String - All data built in layers from the basic types is
Stringable - The data in image or sound files is Stringable
since one need only capture the file name not the
detailed data - Stringable is naturally recursive
7The Displayable Interface
- This interface applies to views
- A view is Displayable if its user input can be
encapsulated into a String - All views that use widgets whose user data can be
expressed as Strings can recursively be
interpreted as Displayable - Note that Displayable captures only the user
input state not the full state of the view
8Example 1 Simple Adder
- 5 TextFieldViews
- 2 Actions
- Add
- Clear
- Model
- 4 int inputs x, y, z, w
- 1 int output sum
9Example 1 Simple Adder
- TextFieldView
- Construct xTFV
- Install in GUI with annotation X
- int x xTFV.demandInt()
- xTFV.setViewState(x )
10Example 1 Simple Adder
- action
- Construct add action object
- Define function add()
- Install add action as a button in GUI
ActionsPanel (with given label) - Link from button to action is automatic
11Key Issues
- Recursion is the king
- Combine simple Displayable GUI components into
larger Displayable GUI components - Combine simpler Stringable models into a larger
Stringable model - requestObject() setViewState()
12Example 2 Polygon Painter
13Example 2 Polygon Painter
BufferedPanel
Point2DView
Point2DView
ActionsPanel
ArrayPanel of Point2DViews and more
14Example 2 Polygon Painter
- private void paintPoly()
- // get the graphics context to draw the
polygon - Graphics2D G window.getBufferGraphics()
-
- Polygon mypoly (Polygon)polygonView.dem
andObject() -
- // set paint color to user color choice
- G.setPaint(color.getColor())
-
- mypoly.paintPolygon(G)
- repaint()
-
15PushDown Automata Explorer
- Language aibjck where i j or i k for i gt
0
16PushDown Automata Explorer
17Turtle Class Explorer
myTurtle.setPaint(0, 0, 255) myTurtle.step(50.0)
myTurtle.turn(60.0) myTurtle.setPaint(255, 0,
255) myTurtle.step(50.0) myTurtle.turn(60.0) my
Turtle.setPaint(255, 0, 0) myTurtle.step(50.0) m
yTurtle.turn(60.0)
18Race Process Priorities
19Race Process Priorities