See the GUI:
Notice a white line between the container and the scrollbar:
Is it possible to make this line disappear?
Code:
public class WhitePixels {
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
JFrame f = new JFrame("A");
JPanel container = new JPanel();
container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
for (int i = 0; i < 15; i++) {
container.add(new JButton("A"));
}
f.setLayout(new BorderLayout());
//some attempts
JScrollPane sp = new JScrollPane(container);
sp.getVerticalScrollBar().setOpaque(false);
sp.getVerticalScrollBar().setBorder(BorderFactory.createEmptyBorder());
sp.setOpaque(false);
f.add(sp);
f.pack();
f.setSize(200, 200);
f.setLocationByPlatform(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
}
Windows 10, Java 1.8

