<Swing Dev> [8] Review request for 4796987 XP Only: JButton.setBorderPainted() does not work with XP L&F
Alexander Scherbatiy
alexandr.scherbatiy at oracle.com
Wed Feb 27 15:11:23 UTC 2013
Could you review the updared fix where 'if' condition is splitted on
two lines:
http://cr.openjdk.java.net/~alexsch/4796987/webrev.02/
Below is a sample that creates buttons with different properties.
- Windows L&F
A background color is not shown before the fix (it is painted under
the button so it slightly visible near the button border).
After the fix the background color is visible for buttons that does
not show a border.
- Aqua L&F
Button with disabled content looks like the original button.
Background is not shown for buttons which have border.
I think that button background issues can be fixed in a separate bug.
----------------------------------------
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.
>>
>
>
More information about the swing-dev
mailing list