summary refs log tree commit diff stats
path: root/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-02-14 13:19:09 -0500
committerStarla Insigna <hatkirby@fourisland.com>2009-02-14 13:19:09 -0500
commit41bc398cfb530ab790f1f7f2e5f3a2c3f0e350c2 (patch)
treece37aa2fd97458c88e702282675c794a5dada6ea /src/com/fourisland/fourpuzzle/window/ChoiceWindow.java
parent67890906cf4c4aa2967bdc50cd947335e6fafb5c (diff)
downloadfourpuzzle-41bc398cfb530ab790f1f7f2e5f3a2c3f0e350c2.tar.gz
fourpuzzle-41bc398cfb530ab790f1f7f2e5f3a2c3f0e350c2.tar.bz2
fourpuzzle-41bc398cfb530ab790f1f7f2e5f3a2c3f0e350c2.zip
Engine: Refactored retieval of FontMetrics
Diffstat (limited to 'src/com/fourisland/fourpuzzle/window/ChoiceWindow.java')
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/window/ChoiceWindow.java9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java b/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java index b2a0af7..ef57226 100755 --- a/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java +++ b/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java
@@ -39,18 +39,15 @@ public class ChoiceWindow implements Renderable {
39 numChoices = choices.size(); 39 numChoices = choices.size();
40 this.center = center; 40 this.center = center;
41 41
42 Graphics2D g3 = Display.createCanvas(1, 1).createGraphics();
43 Display.setFont(g3);
44
45 for (String choice : choices) 42 for (String choice : choices)
46 { 43 {
47 int l = g3.getFontMetrics().stringWidth(choice); 44 int l = Display.getFontMetrics().stringWidth(choice);
48 if (l > getWidth()) 45 if (l > getWidth())
49 { 46 {
50 width = l; 47 width = l;
51 } 48 }
52 49
53 height += g3.getFontMetrics().getHeight() + SPACER; 50 height += Display.getFontMetrics().getHeight() + SPACER;
54 } 51 }
55 52
56 cacheBase = Window.Default.getImage(width, height); 53 cacheBase = Window.Default.getImage(width, height);
@@ -85,7 +82,7 @@ public class ChoiceWindow implements Renderable {
85 g2.setPaint(new TexturePaint(SystemGraphic.getTextColor(), new Rectangle(tx, ty, fw, fh))); 82 g2.setPaint(new TexturePaint(SystemGraphic.getTextColor(), new Rectangle(tx, ty, fw, fh)));
86 g2.drawString(choice, tx, ty); 83 g2.drawString(choice, tx, ty);
87 84
88 ty+=(SPACER+g2.getFontMetrics().getHeight()); 85 ty+=(SPACER+fh);
89 } 86 }
90 } 87 }
91 88