Site MapHelpFeedbackChapter Summary
Chapter Summary
(See related pages)

  • User actions such as moving or dragging the mouse and clicking the mouse buttons will result in the generation of mouse events.
  • By using layout managers, absolute positioning of GUI components on a container becomes unnecessary.
  • Effective layout of GUI components is achieved by nesting panels and applying different layout managers to the panels.
  • There are many different kinds of GUI components, each suitable for a particular type of application.
  • The standard classes and interfaces described or used in this chapter are
    MouseListener GridLayout
    MouseMotionListener JCheckBox
    MouseEvent ItemListener
    JPanel ItemEvent
    FlowLayout JRadioButton
    BorderLayout ButtonGroup
    JComboBox JSlider
    JList ChangeListener
    JScrollPane ChangeEvent
  • MouseListener handles the button actions, and MouseMotionListener handles the mouse movements.
  • JPanel is a container for GUI components. JPanel itself is a GUI component, and therefore, we can nest JPanel objects.
  • The FlowLayout manager places components in left-to-right, top-to-bottom order.
  • The BorderLayout manager places components in one of the five regions: north, south, east, west, and center.
  • The GridLayout manager places components in one of the equal-size N . M grids.
  • The JCheckBox class is used for check-box buttons. An instance of the class generates action and item events.
  • ItemEvent is generated when the state (selected/deselected) of an item changes.
  • ItemEvent is handled by an instance of a class that implements the ItemListener interface.
  • The JRadioButton class is used for radio buttons. An instance of the class generates action and item events.
  • The JComboBox class is used for combo boxes, also known as drop-down lists. An instance of the class generates action and item events.
  • The JList class is used for displaying a list of items. (Note: A JList object generates action and list events. To keep the examples brief and at the
  • introductory level, we did not give any sample code that deals with events generated by a JList object.)
  • The JSlider class is used for sliders. An instance of the class generates change events.
  • ChangeEvent is handled by an instance of a class that implements the ChangeListener interface.







Java3eOnline Learning Center

Home > Chapter 14 > Chapter Summary