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. import javax.swing.*;
  9. import javax.swing.event.*;
  10. import java.io.Serializable;
  11. /**
  12. * OptionComboBoxModel extends the capabilities of the DefaultComboBoxModel,
  13. * to store the Option that is initially marked as selected.
  14. * This is stored, in order to enable an accurate reset of the
  15. * ComboBox that represents the SELECT form element when the
  16. * user requests a clear/reset. Given that a combobox only allow
  17. * for one item to be selected, the last OPTION that has the
  18. * attribute set wins.
  19. *
  20. @author Sunita Mani
  21. @version 1.8 12/19/03
  22. */
  23. class OptionComboBoxModel extends DefaultComboBoxModel implements Serializable {
  24. private Option selectedOption = null;
  25. /**
  26. * Stores the Option that has been marked its
  27. * selected attribute set.
  28. */
  29. public void setInitialSelection(Option option) {
  30. selectedOption = option;
  31. }
  32. /**
  33. * Fetches the Option item that represents that was
  34. * initially set to a selected state.
  35. */
  36. public Option getInitialSelection() {
  37. return selectedOption;
  38. }
  39. }