[PATCH 2 of 2] Do not paint the JRootPane for Windows that get their decoration from the system and do not have a menu bar
Ingo Proetel
proetel at aicas.de
Thu Apr 21 00:36:15 PDT 2011
# HG changeset patch
# User Ingo Proetel <proetel at aicas.de>
# Date 1303371344 -7200
# Node ID 0852643719870188c13f141ef395579f08d6f97c
# Parent 033a795ade9cd0e361267719079384ab0d84fdf6
Do not paint the JRootPane for Windows that get their decoration from the system and do not have a menu bar.
diff -r 033a795ade9c -r 085264371987 src/share/classes/sun/awt/peer/cacio/CacioWindowPeer.java
--- a/src/share/classes/sun/awt/peer/cacio/CacioWindowPeer.java Thu Apr 21 09:35:41 2011 +0200
+++ b/src/share/classes/sun/awt/peer/cacio/CacioWindowPeer.java Thu Apr 21 09:35:44 2011 +0200
@@ -148,6 +148,7 @@
// we cannot have menu support...
Window window = (Window) getAWTComponent();
JRootPane jrootpane = new JRootPane();
+ jrootpane.setDoubleBuffered(false);
return jrootpane;
}
@@ -319,27 +320,28 @@
@Override
protected void peerPaint(Graphics g, boolean update) {
- /*
- * Don't paint the whole area, we only need to paint the frame
- * borders
- */
- JComponent c = getSwingComponent();
- if (c != null) {
- Insets insets = getInsets();
-
- Area clip = new Area(c.getBounds());
- Rectangle clip2 =
- new Rectangle(insets.left,
- insets.top,
- c.getWidth() - insets.left - insets.right,
- c.getHeight() - insets.bottom - insets.top);
- clip.subtract(new Area(clip2));
-
- Graphics peerG = new WindowClippedGraphics((Graphics2D) g, clip);
- try {
- c.paint(peerG);
- } finally {
- peerG.dispose();
+ if (shouldDecorate() || getSwingComponent().getJMenuBar() != null) {
+ /*
+ * Don't paint the whole area, we only need to paint the frame
+ * borders
+ */
+ JComponent c = getSwingComponent();
+ if (c != null) {
+ Insets insets = getInsets();
+ Area clip = new Area(c.getBounds());
+ Rectangle clip2 =
+ new Rectangle(insets.left,
+ insets.top,
+ c.getWidth() - insets.left - insets.right,
+ c.getHeight() - insets.bottom - insets.top);
+ clip.subtract(new Area(clip2));
+
+ Graphics peerG = new WindowClippedGraphics((Graphics2D) g, clip);
+ try {
+ c.paint(peerG);
+ } finally {
+ peerG.dispose();
+ }
}
}
}
More information about the caciocavallo-dev
mailing list