I am using the validation api from here http://java.dzone.com/news/how-quickly-add-validation. It works okay when i put all my components in a panel.However,if my components are in a panel wrapped in a Jscrollpane,the red validation error icons remain static as i scroll.I have tried to do a revalidate and repaint(on the adjustment listener) to no avail.
majorPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener(){
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
frame.revalidate();
frame.repaint();
}
});
However,if i resize the screen,the icons flow to the correct location.For experiments sake. i did the following..slightly force a resize,and now it works..However that little resize is still visible and annoying...
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int ScreenWidth = (int) screenSize.getWidth();
int ScreenHeight = (int) screenSize.getHeight();
majorPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener(){
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
frame.setSize(ScreenWidth-15, ScreenHeight-15);
frame.setExtendedState(Resource.MAXIMIZED_BOTH);
frame.revalidate();
frame.repaint();
}
});
So How can i force a repaint as effective as the resize??? or any better suggestions??