New Components: ScrollPanes and PopupMenus
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.