CS 235 - Week 10 Lab - 2015-10-28

*   an interesting difference between ItemListener
    and ActionListener with regard to JCheckBox

    *   you can fire a JCheckBox's item listener
        by calling 

	setSelected(boolean)

        so, if you say:

	myCheckBox.setSelected(true);

       ...then myCheckBox's state will be selected,
       AND its item listener will be fired

	(but that's not the case for an action listener)

*   note about JRadioButton and ButtonGroup:

    ButtonGroup has a method getSelection -- but
    it does not return the radio button currently selected;
    
    it returns a a reference to the ButtonModel (!)
    attached to the selected button!

    *   IF you set getActionCommand for a radio button,
        though, then ButtonModel's getActionCommand
	will GET it, and that can be useful in a
	listener method...
	
*   JComboBox - is Swing's version of a drop-down selection
    component
    *   good when you would like the user to choose
        something, but in less screen space...

    *   aha! preferred to specify TYPE of the items in the
        JComboBox when you declare and initialize it:
	e.g., for a JComboBox with String items:

	private JComboBox<String> shellComboBox;
        ...
        shellComboBox = new JComboBox<String>(SHELLS);

    *   classic: when the user clicks on the component,
        a list of choices drops down, and the user can
	select one of them
  
    *   BUT has more options as well --
        if you make it editable, user can edit the current
	selection as if it were a text field, and select
	that as their option;

    *   you can also say how many rows to "display" when
        not selected;

    *   some methods:
        getSelectedItem
        addItem
        insertItemAt
        removeItem
        removeItemAt
        removeAllItems

*   how about menus?

    *   I mean a menu bar with pull-down menus;

    *   a JMenuBar contains JMenu instances;
        each JMenu instance contains JMenuItem instances

    *   only "top-level" containers can have a JMenuBar --
        JFrame is a top-level container, JPanel is not;

    *   so: I'll add an "empty" JMenuBar in my JFrame
        subclass,
	and PASS it to the master-JPanel-subclass-constructor
        to have JMenus and JMenuItems added to it;

*   JScrollBar

    *   a slider!
    *   these work very nicely with AdjustmentEvents

    *   if you implement AdjustmentListener,
        you need to create a method
	public void adjustmentValueChanged(AdjustmentEvent event)

    *   ONE of JScrollBar's constructors:
        *   orientation: SCrollBar.HORIZONTAL or JScrollBar.VERTICAL
        *   initial value (as an int) - WHERE the "bar" is
                initially on the scrollbar
        *   extent: an int, how "long" the bar on the scrollbar
                is
        *   minimum value of the scrollbar (an int)
        *   maximum value of the scrollbar (an int)

        *   NOTE: you may want to make the maximum value
	    a bit BIGGER -- because the "left" or "top"
	    edge of the bar determines the scrollbar's value
	    (you can't actually scroll the bar to the maximum
	    value...!)

    *   method getValue will return the current value
        of the "left" or "top" edge of the scrollbar bar

*   see latest version of ComponentPlay.java for demos of 
    much of the above (and more);