-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
The resize listener for JFrame is not working properly, because it is called at
the end of an resize event (and not continously while resizing).
Solution:
The ComponentListener (ComponentAdapter) has to be added to the ContentPane of
the JFrame. This Listener will only receive resize events, because the
ContentPane will never be moved relative to the JFrame.
Suggestion:
// in SwingComponent
final Component resizeListenerComponent; // may be replaced by method
if (getUiReference() instanceof JFrame) {
resizeListenerComponent = ((JFrame) getUiReference()).getContentPane();
}
else {
resizeListenerComponent = getUiReference();
}
resizeListenerComponent.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(final ComponentEvent e) {
componentObservable.fireSizeChanged();
}
});
getUiReference().addComponentListener(new ComponentAdapter() {
@Override
public void componentMoved(final ComponentEvent e) {
componentObservable.firePositionChanged();
}
});
Original issue reported on code.google.com by [email protected] on 22 Apr 2011 at 1:29