by Bob Futrelle, January 2003 This demo shows how to set up and use menus which cause graphics to be drawn. The focus here is on the menus and the actions they trigger. ShowRectOval is the driver which is created and its setup() is called. setup() in turn creates a JFrame for its top-level container. setup() then creates a RectOvalGUI instance with a size passed to it. Then a RectOvalDrawer is created, which is a JPanel. Finally another setup() method is called on the gui, passing it both the JFrame and the drawer instance. Here's the logic. Until the final GUI setup() is called, the instances are pretty much empty. RectOvalGUI builds the GUI and sets up the menu and the actions. RectOvalDrawer is the JPanel that contains the overridden paint method. All the menus do is to set flags that the drawer uses to decide what to draw. The net effect of all this is that the GUI and the drawing are in separate classes, achieving some modularity, one of my goals. This does not use full OO-based graphic objects. The focus is on the menus and modularity. Note that in the main module, ShowRectOval, there is a test for Apple system properties. This is done to allow the menus to appear in the Apple menu bar when the code is run on a Mac.