CISC370-011 -- demo code from class #5

This page provides links to some short demo programs from class #5 (7 Oct).

Mouser.java shows more detail for MouseAdapter and MouseMotionAdapter than was covered last week.

SimpleMenu.java demonstrates a single JMenuItem with an ActionListener.

SubMenu.java demonstrates a (non-functional) hierarchical menu.

Actions.java shows off Action objects attached to menu items and buttons.

Actions2.java shows a better way to generate a lot of actions, by building a subclass of AbstractAction to encapsulate the background-setting operation.

Actions3.java illustrates enabling and disabling Action objects, with all listeners of each action being notified when it changes state.

Keys.java shows how KeyStroke objects are double-mapped to Actions through InputMaps and ActionMaps.

Toolbars.java demonstrates a the use of a JToolBar with Action objects.

Toolbars2.java shows how multiple toolbars can be used in an application (although this is not recommended by Sun).

Toolbars3.java demonstrates icons ( ) on buttons, menu items, and toolbars.

Layout1.java is a simple illustration of the JFrame's BorderLayout.

Layout2.java shows some nested JPanels with a variety of layout options.