71 cg.setFont(comp.getFont());
72 cg.setColor(comp.getForeground());
73 if (cg instanceof Graphics2D) {
74 ((Graphics2D)cg).setBackground(comp.getBackground());
75 } else if (cg instanceof Graphics2Delegate) {
76 ((Graphics2Delegate)cg).setBackground(
77 comp.getBackground());
78 }
79 run(comp, cg);
80 } finally {
81 cg.dispose();
82 }
83 }
84 }
85
86 public final void runComponents(Component[] comps, Graphics g,
87 int weightFlags) {
88 int ncomponents = comps.length;
89 Shape clip = g.getClip();
90
91 if (log.isLoggable(PlatformLogger.FINER) && (clip != null)) {
92 Rectangle newrect = clip.getBounds();
93 log.finer("x = " + newrect.x + ", y = " + newrect.y +
94 ", width = " + newrect.width +
95 ", height = " + newrect.height);
96 }
97
98 // A seriously sad hack--
99 // Lightweight components always paint behind peered components,
100 // even if they are at the top of the Z order. We emulate this
101 // behavior by making two printing passes: the first for lightweights;
102 // the second for heavyweights.
103 //
104 // ToDo(dpm): Either build a list of heavyweights during the
105 // lightweight pass, or redesign the components array to keep
106 // lightweights and heavyweights separate.
107 if ((weightFlags & TWO_PASSES) != 0) {
108 for (int i = ncomponents - 1; i >= 0; i--) {
109 runOneComponent(comps[i], null, g, clip, LIGHTWEIGHTS);
110 }
111 for (int i = ncomponents - 1; i >= 0; i--) {
|
71 cg.setFont(comp.getFont());
72 cg.setColor(comp.getForeground());
73 if (cg instanceof Graphics2D) {
74 ((Graphics2D)cg).setBackground(comp.getBackground());
75 } else if (cg instanceof Graphics2Delegate) {
76 ((Graphics2Delegate)cg).setBackground(
77 comp.getBackground());
78 }
79 run(comp, cg);
80 } finally {
81 cg.dispose();
82 }
83 }
84 }
85
86 public final void runComponents(Component[] comps, Graphics g,
87 int weightFlags) {
88 int ncomponents = comps.length;
89 Shape clip = g.getClip();
90
91 if (log.isLoggable(PlatformLogger.Level.FINER) && (clip != null)) {
92 Rectangle newrect = clip.getBounds();
93 log.finer("x = " + newrect.x + ", y = " + newrect.y +
94 ", width = " + newrect.width +
95 ", height = " + newrect.height);
96 }
97
98 // A seriously sad hack--
99 // Lightweight components always paint behind peered components,
100 // even if they are at the top of the Z order. We emulate this
101 // behavior by making two printing passes: the first for lightweights;
102 // the second for heavyweights.
103 //
104 // ToDo(dpm): Either build a list of heavyweights during the
105 // lightweight pass, or redesign the components array to keep
106 // lightweights and heavyweights separate.
107 if ((weightFlags & TWO_PASSES) != 0) {
108 for (int i = ncomponents - 1; i >= 0; i--) {
109 runOneComponent(comps[i], null, g, clip, LIGHTWEIGHTS);
110 }
111 for (int i = ncomponents - 1; i >= 0; i--) {
|