Basic HTML version of Foils prepared Sept 21 1998

Foil 57 New Components: ScrollPanes and PopupMenus

From Java Tutorial 98- 3: Graphics and the Abstract Windowing Toolkit NAVO Tutorial -- Sept 23 1998. by Geoffrey C. Fox, Nancy McCracken

new component classes for Foil 57
A ScrollPane provides a scrollable area within an existing window. It is a container which can have one other component added to it. This component may have a larger area that will be visible in the ScrollPane. For example, suppose that you have a Canvas drawing area that is 1000 by 1000 pixels wide. You can define a ScrollPane that will view part of it at one time.
  • Canvas draw = new Canvas();
  • draw.setSize (1000, 1000);
  • ScrollPane drawscroller = new ScrollPane();
  • drawscroller.add (draw);
  • drawscroller.setSize (250, 250);
  • add(drawscroller);
A PopupMenu is a sometimes called a context-sensitive menu. On most systems, the right mouse button cause a popup trigger event, and you can create a PopupMenu to appear.



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Nov 28 1998