FileDocCategorySizeDatePackage
ComboBoxEditorExample.javaAPI DocExample2546Thu Oct 24 20:14:22 BST 2002None

ComboBoxEditorExample

public class ComboBoxEditorExample extends Object implements ComboBoxEditor

Fields Summary
Map
map
ImagePanel
panel
ImageIcon
questionIcon
Constructors Summary
public ComboBoxEditorExample(Map m, BookEntry defaultChoice)

        map = m;
        panel = new ImagePanel(defaultChoice); 
        questionIcon = new ImageIcon("question.gif"); 
    
Methods Summary
public voidaddActionListener(java.awt.event.ActionListener l)

        panel.addActionListener(l); 
    
public java.awt.ComponentgetEditorComponent()

 return panel; 
public java.lang.ObjectgetItem()

 return panel.getText(); 
public voidremoveActionListener(java.awt.event.ActionListener l)

        panel.removeActionListener(l); 
    
public voidselectAll()

 panel.selectAll(); 
public voidsetItem(java.lang.Object anObject)

        if (anObject != null) {
            panel.setText(anObject.toString());
            BookEntry entry = (BookEntry)map.get(anObject.toString());
            if (entry != null)
                panel.setIcon(entry.getImage());
            else
                panel.setIcon(questionIcon);
        }