FULL PRODUCT VERSION :
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
When you set a JTextArea to RIGHT_TO_LEFT and setLineWrap to true, then add this text area to a JPanel the entire panel gets blanked out.
But if you don't have lineWrap set it is displayed correctly.
NOTE: This was fixed under mustang(b48) which had Bug ID# 6283270 but is still a problem under 1.5
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Using the code snippet below just run testLineWrap() you will get 4 successive dialogs showing the different combinations of orientation and lineWrap, and the last dialog which sets the orientation to RIGHT_TO_LEFT and sets the LineWrap true will be a blank dialog.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
You should get 4 dialogs showing all 3 components.
first dialog titled "LtoR No Line Wrap"
"Test Label" [Hello There ] TestButton
second dialog titled "LtoR Line Wrap"
"Test Label" [Hello There ] TestButton
third dialog titled "RtoL No Line Wrap"
TestButton [ Hello There] "Test Label"
forth dialog titled "RtoL Line Wrap"
TestButton [ Hello There] "Test Label"
ACTUAL -
first dialog titled "LtoR No Line Wrap"
"Test Label" [Hello There ] TestButton
second dialog titled "LtoR Line Wrap"
"Test Label" [Hello There ] TestButton
third dialog titled "RtoL No Line Wrap"
TestButton [ Hello There] "Test Label"
forth dialog titled "RtoL Line Wrap"
<BLANK>
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
private void testLineWrap()
{
testDialog("LtoR No Line Wrap", ComponentOrientation.LEFT_TO_RIGHT, false);
testDialog("LtoR Line Wrap", ComponentOrientation.LEFT_TO_RIGHT, true);
testDialog("RtoL No Line Wrap", ComponentOrientation.RIGHT_TO_LEFT, false);
testDialog("RtoL Line Wrap", ComponentOrientation.RIGHT_TO_LEFT, true);
}
private void testDialog(String title, ComponentOrientation orientation, boolean shouldLineWrap)
{
JTextArea widget = new JTextArea(1, 40);
widget.setComponentOrientation(orientation);
widget.setLineWrap(shouldLineWrap);
widget.setText("hello there");
JLabel label = new JLabel("Test Label");
label.setComponentOrientation(orientation);
JButton button = new JButton("Test Button");
button.setComponentOrientation(orientation);
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout());
panel.setComponentOrientation(orientation);
panel.add(label);
panel.add(widget);
panel.add(button);
JDialog dialog = new JDialog((Frame)null, title, true);
dialog.setComponentOrientation(orientation);
dialog.getContentPane().add(panel, BorderLayout.CENTER);
dialog.pack();
dialog.setResizable(true);
dialog.setVisible(true);
}
---------- END SOURCE ----------