In FlowLayout
if there is no space for components, some of them moving to the next line. Is there way to check if layout overflowed programmatically?
You can use ChangeListener
for JScrollPane
final JScrollPane jPane = new JScrollPane(yourPanel);
jPane.getViewport().addChangeListener(new ChangeListener() {
public void stateChange(ChangeEvent e) {
//if that is true, it means panel overflowed
if(jPane.getHorizontalScrollBar().isShowing()) {
}
}
})