KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > text > html > OptionComboBoxModel


1 /*
2  * @(#)OptionComboBoxModel.java 1.8 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package javax.swing.text.html;
8
9 import javax.swing.*;
10 import javax.swing.event.*;
11 import java.io.Serializable JavaDoc;
12
13
14 /**
15  * OptionComboBoxModel extends the capabilities of the DefaultComboBoxModel,
16  * to store the Option that is initially marked as selected.
17  * This is stored, in order to enable an accurate reset of the
18  * ComboBox that represents the SELECT form element when the
19  * user requests a clear/reset. Given that a combobox only allow
20  * for one item to be selected, the last OPTION that has the
21  * attribute set wins.
22  *
23   @author Sunita Mani
24   @version 1.8 12/19/03
25  */

26
27 class OptionComboBoxModel extends DefaultComboBoxModel implements Serializable JavaDoc {
28
29     private Option JavaDoc selectedOption = null;
30
31     /**
32      * Stores the Option that has been marked its
33      * selected attribute set.
34      */

35     public void setInitialSelection(Option JavaDoc option) {
36     selectedOption = option;
37     }
38
39     /**
40      * Fetches the Option item that represents that was
41      * initially set to a selected state.
42      */

43     public Option JavaDoc getInitialSelection() {
44     return selectedOption;
45     }
46 }
47
Popular Tags