FileDocCategorySizeDatePackage
ComboBoxEditorExample.javaAPI DocExample2798Mon Nov 09 12:45:54 GMT 1998None

ComboBoxEditorExample

public class ComboBoxEditorExample extends Object implements ComboBoxEditor

Fields Summary
Hashtable
hashtable
ImagePanel
panel
ImageIcon
questionIcon
Constructors Summary
public ComboBoxEditorExample(Hashtable h, String defaultTitle)

        hashtable = h;
        Icon defaultIcon = ((JLabel)hashtable.get(defaultTitle)).getIcon();
        panel = new ImagePanel(defaultIcon, defaultTitle); 
        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());
            JLabel label = (JLabel)hashtable.get(anObject.toString());
            if (label != null)
                panel.setIcon(label.getIcon());
            else
                panel.setIcon(questionIcon);
        }