mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-09 16:25:10 +03:00
Native window decorations: when resizing a window to the right or to the bottom, then first fill the new space with the window background color (instead of black) before the layout is updated (issue #339)
This commit is contained in:
@@ -25,6 +25,8 @@ import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Window;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.Collections;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
@@ -289,6 +291,7 @@ class FlatWindowsNativeWindowBorder
|
||||
//---- class WndProc ------------------------------------------------------
|
||||
|
||||
private class WndProc
|
||||
implements PropertyChangeListener
|
||||
{
|
||||
// WM_NCHITTEST mouse position codes
|
||||
private static final int
|
||||
@@ -313,18 +316,36 @@ class FlatWindowsNativeWindowBorder
|
||||
|
||||
// remove the OS window title bar
|
||||
updateFrame( hwnd, (window instanceof JFrame) ? ((JFrame)window).getExtendedState() : 0 );
|
||||
|
||||
// set window background (used when resizing window)
|
||||
updateWindowBackground();
|
||||
window.addPropertyChangeListener( "background", this );
|
||||
}
|
||||
|
||||
void uninstall() {
|
||||
window.removePropertyChangeListener( "background", this );
|
||||
|
||||
uninstallImpl( hwnd );
|
||||
|
||||
// cleanup
|
||||
window = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange( PropertyChangeEvent e ) {
|
||||
updateWindowBackground();
|
||||
}
|
||||
|
||||
private void updateWindowBackground() {
|
||||
Color bg = window.getBackground();
|
||||
if( bg != null )
|
||||
setWindowBackground( hwnd, bg.getRed(), bg.getGreen(), bg.getBlue() );
|
||||
}
|
||||
|
||||
private native long installImpl( Window window );
|
||||
private native void uninstallImpl( long hwnd );
|
||||
private native void updateFrame( long hwnd, int state );
|
||||
private native void setWindowBackground( long hwnd, int r, int g, int b );
|
||||
private native void showWindow( long hwnd, int cmd );
|
||||
|
||||
// invoked from native code
|
||||
|
||||
Reference in New Issue
Block a user