-
Bug
-
Resolution: Unresolved
-
P4
-
7
-
generic
-
generic
Platform: Windows XP SP2
JDK: 1.7
When JScrollPane has null border, the bottom and left scroll bar arrow icons are painted incorrectly. They are shifted by 1px. Please, find a screen shot in the attachment.
There is a test case:
=============== Source Begin ==============
import javax.swing.*;
import java.awt.*;
public class ScrollPanes extends JPanel {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame("JScrollPane arrow test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new ScrollPanes());
frame.setSize(512, 384);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
}
public ScrollPanes() {
super(new GridLayout(2, 2, 1, 1));
JScrollPane leftScrollPane = new JScrollPane(createContent("ScrollPane has default border"));
JScrollPane bottomScrollPane = new JScrollPane(createContent("ScrollPane border is null"));
bottomScrollPane.setBorder(null);
JScrollPane rightScrollPane = new JScrollPane(createContent("ScrollPane border is null"));
rightScrollPane.setBorder(null);
add(leftScrollPane);
add(rightScrollPane);
add(bottomScrollPane);
}
private JLabel createContent(String text) {
JLabel label = new JLabel(text);
label.setPreferredSize(new Dimension(500, 500));
label.setHorizontalAlignment(JLabel.LEFT);
label.setVerticalAlignment(JLabel.TOP);
label.setOpaque(true);
label.setBackground(Color.WHITE);
return label;
}
}
=============== Source End ==============
Testing strategy:
1. Run the test
2. Note that some scroll bar arrow icons are shifted by 1px (a screen shot in the attachment)
Current behavior:
Some scroll bar arrow icons are asymmetrical about the scroll bar center. They are shifted by 1 pixel.
Expected behavior:
All the scroll bar arrow icons are symmetrical about the scroll bar center.
JDK: 1.7
When JScrollPane has null border, the bottom and left scroll bar arrow icons are painted incorrectly. They are shifted by 1px. Please, find a screen shot in the attachment.
There is a test case:
=============== Source Begin ==============
import javax.swing.*;
import java.awt.*;
public class ScrollPanes extends JPanel {
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame("JScrollPane arrow test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new ScrollPanes());
frame.setSize(512, 384);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
}
public ScrollPanes() {
super(new GridLayout(2, 2, 1, 1));
JScrollPane leftScrollPane = new JScrollPane(createContent("ScrollPane has default border"));
JScrollPane bottomScrollPane = new JScrollPane(createContent("ScrollPane border is null"));
bottomScrollPane.setBorder(null);
JScrollPane rightScrollPane = new JScrollPane(createContent("ScrollPane border is null"));
rightScrollPane.setBorder(null);
add(leftScrollPane);
add(rightScrollPane);
add(bottomScrollPane);
}
private JLabel createContent(String text) {
JLabel label = new JLabel(text);
label.setPreferredSize(new Dimension(500, 500));
label.setHorizontalAlignment(JLabel.LEFT);
label.setVerticalAlignment(JLabel.TOP);
label.setOpaque(true);
label.setBackground(Color.WHITE);
return label;
}
}
=============== Source End ==============
Testing strategy:
1. Run the test
2. Note that some scroll bar arrow icons are shifted by 1px (a screen shot in the attachment)
Current behavior:
Some scroll bar arrow icons are asymmetrical about the scroll bar center. They are shifted by 1 pixel.
Expected behavior:
All the scroll bar arrow icons are symmetrical about the scroll bar center.