-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta3
-
generic
-
generic
-
Verified
OS: All tested OS's with RTL locale suppor
testCase: jScrollBar.java
Horizontal JScrollBar's visual behavior is correct and displayed from RTL
if locale is Arabic or Hebrew BUT the calculated value of the
adjustmentListener is LTR, meaning that instead of value "0" at HOME
location it is 280 . The END location value is 0 instead of 280.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class jScrollBar extends JApplet
{
public void init()
{
ScrollBarExample sbe = new ScrollBarExample();
getContentPane().add(sbe);
}
public static void main(String[] argv)
{
JFrame frame = new JFrame("ABCDEFG");
frame.setContentPane(new ScrollBarExample());
frame.setSize(300,300);
frame.setVisible(true);
frame.addWindowListener( new WindowAdapter()
{
public void windowClosing( WindowEvent e)
{
System.exit(0);
}
});
}
}
class ScrollBarExample extends JPanel
{
JPanel p;
JLabel label;
public ScrollBarExample()
{
super(true);
label=new JLabel();
label.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
setLayout(new BorderLayout());
JScrollBar hbar=new JScrollBar(JScrollBar.HORIZONTAL, 30, 20, 0, 300);
JScrollBar vbar=new JScrollBar(JScrollBar.VERTICAL, 30, 40, 0, 300);
hbar.setUnitIncrement(2);
hbar.setBlockIncrement(1);
hbar.addAdjustmentListener(new MyAdjustmentListener());
vbar.addAdjustmentListener(new MyAdjustmentListener());
setBackground(Color.white);
add(hbar, BorderLayout.SOUTH);
add(vbar, BorderLayout.EAST);
add(label, BorderLayout.CENTER);
}
class MyAdjustmentListener implements AdjustmentListener
{
public void adjustmentValueChanged(AdjustmentEvent e)
{
label.setText("\u0627\u0644\u0642\u064a\u0645\u0629\u0020\u0627\u0644\u062c\u062f\u064a\u062f\u0629 " + e.getValue() + " ");
repaint();
}
}
}
testCase: jScrollBar.java
Horizontal JScrollBar's visual behavior is correct and displayed from RTL
if locale is Arabic or Hebrew BUT the calculated value of the
adjustmentListener is LTR, meaning that instead of value "0" at HOME
location it is 280 . The END location value is 0 instead of 280.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class jScrollBar extends JApplet
{
public void init()
{
ScrollBarExample sbe = new ScrollBarExample();
getContentPane().add(sbe);
}
public static void main(String[] argv)
{
JFrame frame = new JFrame("ABCDEFG");
frame.setContentPane(new ScrollBarExample());
frame.setSize(300,300);
frame.setVisible(true);
frame.addWindowListener( new WindowAdapter()
{
public void windowClosing( WindowEvent e)
{
System.exit(0);
}
});
}
}
class ScrollBarExample extends JPanel
{
JPanel p;
JLabel label;
public ScrollBarExample()
{
super(true);
label=new JLabel();
label.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
setLayout(new BorderLayout());
JScrollBar hbar=new JScrollBar(JScrollBar.HORIZONTAL, 30, 20, 0, 300);
JScrollBar vbar=new JScrollBar(JScrollBar.VERTICAL, 30, 40, 0, 300);
hbar.setUnitIncrement(2);
hbar.setBlockIncrement(1);
hbar.addAdjustmentListener(new MyAdjustmentListener());
vbar.addAdjustmentListener(new MyAdjustmentListener());
setBackground(Color.white);
add(hbar, BorderLayout.SOUTH);
add(vbar, BorderLayout.EAST);
add(label, BorderLayout.CENTER);
}
class MyAdjustmentListener implements AdjustmentListener
{
public void adjustmentValueChanged(AdjustmentEvent e)
{
label.setText("\u0627\u0644\u0642\u064a\u0645\u0629\u0020\u0627\u0644\u062c\u062f\u064a\u062f\u0629 " + e.getValue() + " ");
repaint();
}
}
}
- relates to
-
JDK-4488482 Merlin, Horizontal JScrollBar does not respect ComponentOrientation
- Closed