/[classpath]/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/metal/MetalComboBoxUI.java

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

revision 1.1.2.4 by gnu_andrew, Tue Sep 20 18:46:34 2005 UTC revision 1.1.2.5 by gnu_andrew, Wed Nov 2 00:44:00 2005 UTC
# Line 41  package javax.swing.plaf.metal; Line 41  package javax.swing.plaf.metal;
41  import java.awt.Container;  import java.awt.Container;
42  import java.awt.Dimension;  import java.awt.Dimension;
43  import java.awt.Graphics;  import java.awt.Graphics;
44    import java.awt.Insets;
45  import java.awt.LayoutManager;  import java.awt.LayoutManager;
46  import java.awt.Rectangle;  import java.awt.Rectangle;
47  import java.awt.event.MouseEvent;  import java.awt.event.MouseEvent;
# Line 49  import java.beans.PropertyChangeListener Line 50  import java.beans.PropertyChangeListener
50    
51  import javax.swing.CellRendererPane;  import javax.swing.CellRendererPane;
52  import javax.swing.ComboBoxEditor;  import javax.swing.ComboBoxEditor;
53    import javax.swing.Icon;
54  import javax.swing.JButton;  import javax.swing.JButton;
55  import javax.swing.JComboBox;  import javax.swing.JComboBox;
56  import javax.swing.JComponent;  import javax.swing.JComponent;
# Line 61  import javax.swing.plaf.basic.ComboPopup Line 63  import javax.swing.plaf.basic.ComboPopup
63  /**  /**
64   * A UI delegate for the {@link JComboBox} component.   * A UI delegate for the {@link JComboBox} component.
65   */   */
66  public class MetalComboBoxUI  public class MetalComboBoxUI extends BasicComboBoxUI
   extends BasicComboBoxUI  
67  {  {
68    /**    /**
69     * A layout manager that arranges the editor component (if active) and the     * A layout manager that arranges the editor component (if active) and the
# Line 75  public class MetalComboBoxUI Line 76  public class MetalComboBoxUI
76       * Creates a new instance of the layout manager.       * Creates a new instance of the layout manager.
77       */       */
78      public MetalComboBoxLayoutManager()      public MetalComboBoxLayoutManager()
79      {            {
80          // Nothing to do here.
81      }      }
82            
83      /**      /**
# Line 121  public class MetalComboBoxUI Line 123  public class MetalComboBoxUI
123       */       */
124      public MetalPropertyChangeListener()      public MetalPropertyChangeListener()
125      {      {
126          // Nothing to do here.
127      }      }
128            
129      /**      /**
# Line 209  public class MetalComboBoxUI Line 212  public class MetalComboBoxUI
212     */     */
213    protected JButton createArrowButton()    protected JButton createArrowButton()
214    {    {
215      return new MetalComboBoxButton(comboBox, new MetalComboBoxIcon(),      JButton button = new MetalComboBoxButton(comboBox, new MetalComboBoxIcon(),
216              new CellRendererPane(), listBox);                new CellRendererPane(), listBox);  
217        button.setMargin(new Insets(0, 1, 1, 3));
218        return button;
219    }    }
220        
221    /**    /**
# Line 251  public class MetalComboBoxUI Line 256  public class MetalComboBoxUI
256        }        }
257      else      else
258        {        {
259          arrowButton.setText(comboBox.getSelectedItem().toString());          String text = "";
260            Object selected = comboBox.getSelectedItem();
261            if (selected != null)
262              text = selected.toString();
263            arrowButton.setText(text);
264          if (editor != null)          if (editor != null)
265            editor.setVisible(true);            editor.setVisible(true);
266        }        }
# Line 286  public class MetalComboBoxUI Line 295  public class MetalComboBoxUI
295     */     */
296    public Dimension getMinimumSize(JComponent c)    public Dimension getMinimumSize(JComponent c)
297    {    {
298      // FIXME: this needs work      MetalComboBoxButton b = (MetalComboBoxButton) arrowButton;
299      Dimension result = super.getMinimumSize(c);      Icon icon = b.getComboIcon();
300      result.height = result.height + 9;      Insets insets = b.getInsets();
301      return result;        Dimension d = getDisplaySize();
302        int insetsH = insets.top + insets.bottom;
303        int insetsW = insets.left + insets.right;
304        int iconWidth = icon.getIconWidth() + 6;
305        return new Dimension(d.width + insetsW + iconWidth,
306                d.height + insetsH);
307    }    }
308        
309  }  }

Legend:
Removed from v.1.1.2.4  
changed lines
  Added in v.1.1.2.5

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