1 /*
2 * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
54 return;
55 }
56 boolean lightweight = comp.isLightweight();
57 if ((lightweight && (weightFlags & LIGHTWEIGHTS) == 0) ||
58 (!lightweight && (weightFlags & HEAVYWEIGHTS) == 0)) {
59 return;
60 }
61
62 if (bounds == null) {
63 bounds = comp.getBounds();
64 }
65
66 if (clip == null || clip.intersects(bounds)) {
67 Graphics cg = g.create();
68 try {
69 constrainGraphics(cg, bounds);
70 cg.setFont(comp.getFont());
71 cg.setColor(comp.getForeground());
72 if (cg instanceof Graphics2D) {
73 ((Graphics2D)cg).setBackground(comp.getBackground());
74 } else if (cg instanceof Graphics2Delegate) {
75 ((Graphics2Delegate)cg).setBackground(
76 comp.getBackground());
77 }
78 run(comp, cg);
79 } finally {
80 cg.dispose();
81 }
82 }
83 }
84
85 public final void runComponents(Component[] comps, Graphics g,
86 int weightFlags) {
87 int ncomponents = comps.length;
88 Shape clip = g.getClip();
89
90 if (log.isLoggable(PlatformLogger.Level.FINER) && (clip != null)) {
91 Rectangle newrect = clip.getBounds();
92 log.finer("x = " + newrect.x + ", y = " + newrect.y +
93 ", width = " + newrect.width +
94 ", height = " + newrect.height);
95 }
96
|
1 /*
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
54 return;
55 }
56 boolean lightweight = comp.isLightweight();
57 if ((lightweight && (weightFlags & LIGHTWEIGHTS) == 0) ||
58 (!lightweight && (weightFlags & HEAVYWEIGHTS) == 0)) {
59 return;
60 }
61
62 if (bounds == null) {
63 bounds = comp.getBounds();
64 }
65
66 if (clip == null || clip.intersects(bounds)) {
67 Graphics cg = g.create();
68 try {
69 constrainGraphics(cg, bounds);
70 cg.setFont(comp.getFont());
71 cg.setColor(comp.getForeground());
72 if (cg instanceof Graphics2D) {
73 ((Graphics2D)cg).setBackground(comp.getBackground());
74 }
75 run(comp, cg);
76 } finally {
77 cg.dispose();
78 }
79 }
80 }
81
82 public final void runComponents(Component[] comps, Graphics g,
83 int weightFlags) {
84 int ncomponents = comps.length;
85 Shape clip = g.getClip();
86
87 if (log.isLoggable(PlatformLogger.Level.FINER) && (clip != null)) {
88 Rectangle newrect = clip.getBounds();
89 log.finer("x = " + newrect.x + ", y = " + newrect.y +
90 ", width = " + newrect.width +
91 ", height = " + newrect.height);
92 }
93
|