I have a JScrollPane with a View. I'm doing a chat application , it's why i need to have my ScrollBar to the Maximum(). To get the right Maximum of the View i have to validate before. When I validate my ScrollPane an automatic repaint is doing. I don't want this repaint because it makes a double repaint when i set the ScrollBar to the Maximum : when the ScrollBar is at the top and a another when it is a the bottom.
my code :
Main.getWindow().getMainPanel().getScrollPaneCenter().validate();
scrollPaneCenter.getVerticalScrollBar().setValue(scrollPaneCenter.getVerticalScrollBar().getMaximum());
PS : I want to disable the repaint of my conponent or maybe you have a solution to have a reversed JScrollPane( to always have the ScrollBar to Bottom) .
pan.setBackground(new Color(1, 0, 0, 0));
pan.setLayout(null);
int taillePanel = 0;
for (int i = 0; i < 20; i++) {
JButton test = new JButton("Button number : " + i);
test.setBorderPainted(false);
test.setBounds(0, (i * 75), 250, 75);
taillePanel += 75;
pan.insertComponent(test);}
pan.setPreferredSize(new Dimension(250, taillePanel)); JScrollPane scrollPaneCenter = new JScrollPane(pan);` – g3r4n Jul 25 '13 at 17:36