/[classpath]/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicComboBoxUI.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5.2.2 by gnu_andrew, Sat Jan 15 17:02:21 2005 UTC revision 1.5.2.3 by gnu_andrew, Sun Jan 16 15:15:13 2005 UTC
# Line 80  import javax.swing.plaf.ComponentUI; Line 80  import javax.swing.plaf.ComponentUI;
80   * UI Delegate for JComboBox   * UI Delegate for JComboBox
81   *   *
82   * @author Olga Rodimina   * @author Olga Rodimina
83     * @author Robert Schuster
84   */   */
85  public class BasicComboBoxUI extends ComboBoxUI  public class BasicComboBoxUI extends ComboBoxUI
86  {  {
# Line 783  public class BasicComboBoxUI extends Com Line 784  public class BasicComboBoxUI extends Com
784        {        {
785          Object currentValue = comboBox.getSelectedItem();          Object currentValue = comboBox.getSelectedItem();
786          boolean isPressed = arrowButton.getModel().isPressed();          boolean isPressed = arrowButton.getModel().isPressed();
787          if (currentValue != null)  
788            {          /* Gets the component to be drawn for the current value.
789              Component comp = comboBox.getRenderer()           * If there is currently no selected item we will take an empty
790             * String as replacement.
791             */
792            Component comp = comboBox.getRenderer()
793                                       .getListCellRendererComponent(listBox,                                       .getListCellRendererComponent(listBox,
794                                                                     currentValue,                                                                     (currentValue != null ? currentValue : ""),
795                                                                     -1,                                                                     -1,
796                                                                     isPressed,                                                                     isPressed,
797                                                                     hasFocus);                                                                     hasFocus);
798              if (! comboBox.isEnabled())          if (! comboBox.isEnabled())
799                comp.setEnabled(false);                comp.setEnabled(false);
800    
801              g.translate(borderInsets.left, borderInsets.top);          g.translate(borderInsets.left, borderInsets.top);
802              comp.setBounds(0, 0, bounds.width, bounds.height);              comp.setBounds(0, 0, bounds.width, bounds.height);
803              comp.paint(g);              comp.paint(g);
804              g.translate(-borderInsets.left, -borderInsets.top);              g.translate(-borderInsets.left, -borderInsets.top);
805            }              
806          comboBox.revalidate();          comboBox.revalidate();
807        }        }
808      else      else

Legend:
Removed from v.1.5.2.2  
changed lines
  Added in v.1.5.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26