1. /*
  2. * @(#)OptionComboBoxModel.java 1.5 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.swing.text.html;
  11. import javax.swing.*;
  12. import javax.swing.event.*;
  13. import java.io.Serializable;
  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.5 02/02/00
  25. */
  26. class OptionComboBoxModel extends DefaultComboBoxModel implements Serializable {
  27. private Option selectedOption = null;
  28. /**
  29. * Stores the Option that has been marked its
  30. * selected attribute set.
  31. */
  32. public void setInitialSelection(Option option) {
  33. selectedOption = option;
  34. }
  35. /**
  36. * Fetches the Option item that represents that was
  37. * initially set to a selected state.
  38. */
  39. public Option getInitialSelection() {
  40. return selectedOption;
  41. }
  42. }