author | ohair |
Thu, 17 Sep 2009 13:17:57 -0700 | |
changeset 3790 | ab4f91337479 |
parent 534 | be8500bc69b2 |
child 5506 | 202f599c92aa |
permissions | -rw-r--r-- |
534
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
1 |
/* |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
2 |
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
4 |
* |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
8 |
* |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
13 |
* accompanied this code). |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
14 |
* |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
18 |
* |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
19 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
21 |
* have any questions. |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
22 |
*/ |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
23 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
24 |
/** |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
25 |
* @test |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
26 |
* @bug 6684056 |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
27 |
* @summary Super-scripted text needs to be positioned the same with |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
28 |
* drawString and TextLayout. |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
29 |
*/ |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
30 |
import java.awt.*; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
31 |
import java.awt.event.*; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
32 |
import java.awt.font.*; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
33 |
import static java.awt.font.TextAttribute.*; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
34 |
import java.awt.geom.AffineTransform; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
35 |
import java.awt.image.BufferedImage; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
36 |
import java.util.HashMap; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
37 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
38 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
39 |
public class DrawStrSuper extends Component { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
40 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
41 |
int angle = 0; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
42 |
static boolean interactive = false; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
43 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
44 |
int wid=400, hgt=400; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
45 |
BufferedImage bi = null; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
46 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
47 |
void paintImage() { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
48 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
49 |
if (bi == null) { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
50 |
bi = new BufferedImage(wid, hgt, BufferedImage.TYPE_INT_RGB); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
51 |
} |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
52 |
Graphics2D g2d = bi.createGraphics(); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
53 |
g2d.setColor(Color.white); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
54 |
g2d.fillRect(0, 0, wid, hgt); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
55 |
g2d.translate(200, 200); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
56 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
57 |
Font fnt = new Font("Arial", Font.PLAIN, 20); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
58 |
fnt = fnt.deriveFont(60.0f); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
59 |
HashMap attrMap = new HashMap(); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
60 |
AffineTransform aff = |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
61 |
AffineTransform.getRotateInstance(angle * Math.PI/180.0); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
62 |
attrMap.put(SUPERSCRIPT, SUPERSCRIPT_SUPER); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
63 |
attrMap.put(TRANSFORM, aff); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
64 |
fnt = fnt.deriveFont(attrMap); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
65 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
66 |
g2d.setFont(fnt); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
67 |
g2d.setColor(Color.yellow); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
68 |
TextLayout tl = new TextLayout("Text", fnt,g2d.getFontRenderContext()); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
69 |
g2d.fill(tl.getBounds()); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
70 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
71 |
g2d.setColor(Color.black); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
72 |
g2d.drawLine(-3, 0, 3, 0); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
73 |
g2d.drawLine(0, -3, 0, 3); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
74 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
75 |
g2d.setColor(Color.blue); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
76 |
g2d.drawString("Text", 0, 0); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
77 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
78 |
g2d.setColor(Color.red); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
79 |
tl.draw(g2d,0f,0f); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
80 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
81 |
// Test BI: should be no blue |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
82 |
int blue = Color.blue.getRGB(); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
83 |
for (int px=0;px<wid;px++) { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
84 |
for (int py=0;py<hgt;py++) { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
85 |
int rgb = bi.getRGB(px, py); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
86 |
if (rgb == blue) { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
87 |
throw new RuntimeException |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
88 |
("Unexpected color : " + Integer.toHexString(rgb) + |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
89 |
" at x=" + px + " y="+ py); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
90 |
} |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
91 |
} |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
92 |
} |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
93 |
} |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
94 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
95 |
@Override |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
96 |
public void paint(Graphics g) { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
97 |
paintImage(); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
98 |
g.drawImage(bi, 0,0, null); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
99 |
} |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
100 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
101 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
102 |
static class Runner extends Thread { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
103 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
104 |
DrawStrSuper dss; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
105 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
106 |
Runner(DrawStrSuper dss) { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
107 |
this.dss = dss; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
108 |
} |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
109 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
110 |
public void run() { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
111 |
while (true) { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
112 |
if (!interactive && dss.angle > 360) { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
113 |
return; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
114 |
} |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
115 |
try { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
116 |
Thread.sleep(100); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
117 |
} catch (InterruptedException e) { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
118 |
return; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
119 |
} |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
120 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
121 |
dss.angle += 10; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
122 |
dss.repaint(); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
123 |
} |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
124 |
} |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
125 |
} |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
126 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
127 |
@Override |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
128 |
public Dimension getPreferredSize() { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
129 |
return new Dimension(400, 400); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
130 |
} |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
131 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
132 |
public static void main(String argv[]) throws InterruptedException { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
133 |
if (argv.length > 0) interactive = true; |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
134 |
|
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
135 |
Frame f = new Frame("Text bounds test"); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
136 |
f.addWindowListener(new WindowAdapter() { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
137 |
@Override |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
138 |
public void windowClosing(WindowEvent e) { |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
139 |
System.exit(0); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
140 |
} |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
141 |
}); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
142 |
DrawStrSuper dss = new DrawStrSuper(); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
143 |
f.add(dss, BorderLayout.CENTER); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
144 |
f.pack(); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
145 |
f.setLocationRelativeTo(null); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
146 |
f.setVisible(true); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
147 |
Runner runner = new Runner(dss); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
148 |
runner.start(); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
149 |
runner.join(); |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
150 |
} |
be8500bc69b2
6684056: SUPERSCRIPT TextAttribute on font needs to trigger layout.
prr
parents:
diff
changeset
|
151 |
} |