Chapter 5 Examples


 
Combo Box
SimpleComboExample.java demonstrates the techniques used to create a JComboBox.
 
Combo Box Renderer
MyRenderer.java implements a custom combo box renderer that supports images. ComboExample.java uses the renderer in a JComboBox. Images from the images directory are used.
 
Combo Box Editor
AddFieldEditor.java implements a custom combo box editor that adds items to the list of choices. AddExample.java uses the editor in a JComboBox. Updated to fix an error in the getItem method. This method should return retVal not curItem.
 
Complete Combo Box Example
SimpleRenderer.java implements a custom combo box renderer that supports fonts. JumptoFieldEditor.java implements a custom combo box editor that tries to fill in the users typing based on available choices. JumptoExample.java uses the renderer and editor in a JComboBox. The editor was updated to fix an error in the getItem method. This method should return retVal not curItem. The editor was also updated to fix a new semantic that caused getSelectedItem to return the item being edited but not yet added.
 
Item Listener
Choices.java uses an ItemListener to receive notifications when the selection in a JComboBox changes.
 
List
SimpleListExample.java demonstrates the techniques used to display a JList.
 
Multiple Selection List
MSelListExample.java demonstrates the techniques used to display a JList that supports multiple selections.
 
List Renderer
ListItemRenderer.java implements a list renderer that supports images. ListItem.java objects are used to store the data for the list. ListExample.java uses the renderer in a JList. Images from the images directory are used.
 
List Selection Listener
Selections.java uses an ListSelectionListener to receive notifications when the selection in a JList changes.
 
List Mouse Events
DoubleClickExample.java uses a MouseListener to receive notifications when the user double clicks on an item in a JList.


Copyright � 1998, John Wiley and Sons, Inc.