1. /*
  2. * @(#)SynthComboPopup.java 1.7 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.plaf.synth;
  8. import javax.swing.*;
  9. import javax.swing.event.*;
  10. import javax.swing.plaf.basic.*;
  11. import java.awt.*;
  12. import java.awt.event.*;
  13. import java.beans.PropertyChangeListener;
  14. import java.beans.PropertyChangeEvent;
  15. import java.io.Serializable;
  16. /**
  17. * Synth's ComboPopup.
  18. *
  19. * @version 1.7, 12/19/03
  20. * @author Scott Violet
  21. */
  22. class SynthComboPopup extends BasicComboPopup {
  23. public SynthComboPopup( JComboBox combo ) {
  24. super(combo);
  25. }
  26. /**
  27. * Configures the list which is used to hold the combo box items in the
  28. * popup. This method is called when the UI class
  29. * is created.
  30. *
  31. * @see #createList
  32. */
  33. protected void configureList() {
  34. list.setFont( comboBox.getFont() );
  35. list.setCellRenderer( comboBox.getRenderer() );
  36. list.setFocusable( false );
  37. list.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
  38. int selectedIndex = comboBox.getSelectedIndex();
  39. if ( selectedIndex == -1 ) {
  40. list.clearSelection();
  41. }
  42. else {
  43. list.setSelectedIndex( selectedIndex );
  44. list.ensureIndexIsVisible( selectedIndex );
  45. }
  46. installListListeners();
  47. }
  48. }