< prev index next >

src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java

Print this page
rev 53939 : 8213116: javax/swing/JComboBox/WindowsComboBoxSize/WindowsComboBoxSizeTest.java fails in Windows
Reviewed-by: prr


 327 
 328     /**
 329      * {@inheritDoc}
 330      * @since 1.6
 331      */
 332     public void paintCurrentValueBackground(Graphics g, Rectangle bounds,
 333                                             boolean hasFocus) {
 334         if (XPStyle.getXP() == null) {
 335             super.paintCurrentValueBackground(g, bounds, hasFocus);
 336         }
 337     }
 338 
 339     public Dimension getMinimumSize( JComponent c ) {
 340         Dimension d = super.getMinimumSize(c);
 341         if (XPStyle.getXP() != null) {
 342             d.width += 7;
 343             boolean isEditable = false;
 344             if (c instanceof JComboBox) {
 345                 isEditable = ((JComboBox) c).isEditable();
 346             }



 347             d.height += isEditable ? 4 : 6;

 348         } else {
 349             d.width += 4;
 350             d.height += 2;
 351         }
 352         return d;
 353     }
 354 
 355     /**
 356      * Creates a layout manager for managing the components which make up the
 357      * combo box.
 358      *
 359      * @return an instance of a layout manager
 360      */
 361     protected LayoutManager createLayoutManager() {
 362         return new BasicComboBoxUI.ComboBoxLayoutManager() {
 363             public void layoutContainer(Container parent) {
 364                 super.layoutContainer(parent);
 365 
 366                 if (XPStyle.getXP() != null && arrowButton != null) {
 367                     Dimension d = parent.getSize();




 327 
 328     /**
 329      * {@inheritDoc}
 330      * @since 1.6
 331      */
 332     public void paintCurrentValueBackground(Graphics g, Rectangle bounds,
 333                                             boolean hasFocus) {
 334         if (XPStyle.getXP() == null) {
 335             super.paintCurrentValueBackground(g, bounds, hasFocus);
 336         }
 337     }
 338 
 339     public Dimension getMinimumSize( JComponent c ) {
 340         Dimension d = super.getMinimumSize(c);
 341         if (XPStyle.getXP() != null) {
 342             d.width += 7;
 343             boolean isEditable = false;
 344             if (c instanceof JComboBox) {
 345                 isEditable = ((JComboBox) c).isEditable();
 346             }
 347             if (((JComboBox)c).getBorder() instanceof EmptyBorder) {
 348                 d.height += isEditable ? 2 : 4;
 349             } else {
 350                 d.height += isEditable ? 4 : 6;
 351             }
 352         } else {
 353             d.width += 4;
 354             d.height += 2;
 355         }
 356         return d;
 357     }
 358 
 359     /**
 360      * Creates a layout manager for managing the components which make up the
 361      * combo box.
 362      *
 363      * @return an instance of a layout manager
 364      */
 365     protected LayoutManager createLayoutManager() {
 366         return new BasicComboBoxUI.ComboBoxLayoutManager() {
 367             public void layoutContainer(Container parent) {
 368                 super.layoutContainer(parent);
 369 
 370                 if (XPStyle.getXP() != null && arrowButton != null) {
 371                     Dimension d = parent.getSize();


< prev index next >