<Swing Dev> [8] Review request for 4796987 XP Only: JButton.setBorderPainted() does not work with XP L&F

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Wed Feb 27 16:27:03 UTC 2013


Hi, Alexander.
Fix looks good.

27.02.2013 19:57, Alexander Scherbatiy wrote:
> On 2/27/2013 7:20 PM, Sergey Bylokhov wrote:
>> 27.02.2013 19:11, Alexander Scherbatiy wrote:
>>>
>>>  I think that button background issues can be fixed in a separate bug.
>> I guess this is because different default opaque in win/aqua?
>    I see now. Setting a button opaque to true in Aqua L&F shows a 
> button background in the same way as on Windows L&F.
>
>     Thanks,
>     Alexandr.
>>>
>>> ----------------------------------------
>>> import java.awt.Color;
>>> import javax.swing.*;
>>>
>>> public class TestButtonBorders {
>>>
>>>     public static void main(String[] args) throws Exception {
>>>
>>>         SwingUtilities.invokeAndWait(new Runnable() {
>>>
>>>             @Override
>>>             public void run() {
>>>                 JFrame frame = new JFrame();
>>>                 JPanel panel = new JPanel();
>>>                 panel.setSize(500, 200);
>>>                 JButton button = new JButton();
>>>                 // button
>>>                 button.setText("button");
>>>                 panel.add(button);
>>>                 // disbaled content
>>>                 button = new JButton();
>>>                 button.setText("disabled content");
>>>                 button.setContentAreaFilled(false);
>>>                 panel.add(button);
>>>                 // null border
>>>                 button = new JButton();
>>>                 button.setText("null border");
>>>                 button.setBorder(null);
>>>                 panel.add(button);
>>>                 // border painted false
>>>                 button = new JButton();
>>>                 button.setText("border painted false");
>>>                 button.setBorderPainted(false);
>>>                 panel.add(button);
>>>                 // background green
>>>                 button = new JButton();
>>>                 button.setText("green backgound");
>>>                 button.setBackground(Color.GREEN);
>>>                 panel.add(button);
>>>                 // border painted false, background red
>>>                 button = new JButton();
>>>                 button.setText("red without border");
>>>                 //button.setContentAreaFilled(false);
>>>                 button.setBorderPainted(false);
>>>                 button.setBackground(Color.RED);
>>>                 panel.add(button);
>>>
>>>                 frame.add(panel);
>>>                 frame.setSize(300, 300);
>>>                 frame.setVisible(true);
>>> frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>>>             }
>>>         });
>>>     }
>>> }
>>> ----------------------------------------
>>> Thanks,
>>> Alexandr.
>>>
>>>
>>> On 2/26/2013 7:51 PM, Sergey Bylokhov wrote:
>>>> Hi, Alexander.
>>>> Does JButtons.setBackground work as expected after the fix, and Is 
>>>> it possible to split this "if" in two lines?
>>>>
>>>> Thanks.
>>>>
>>>> 25.02.2013 17:08, Alexander Scherbatiy wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> Could you review the fix:
>>>>>   bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4796987
>>>>>   webrev: http://cr.openjdk.java.net/~alexsch/4796987/webrev.01
>>>>>
>>>>>   The fix does not show a buttton background on Windows XP if the 
>>>>> button border is null or the isBorderPainted flag is false.
>>>>>
>>>>> Thanks,
>>>>> Alexandr.
>>>>>
>>>>
>>>>
>>>
>>
>>
>


-- 
Best regards, Sergey.




More information about the swing-dev mailing list