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-08 13:35:20 -0500
committerStarla Insigna <hatkirby@fourisland.com>2009-02-08 13:35:20 -0500
commit7c8c6e2b37be39fbef4c168342fcdebc4ec58974 (patch)
treedbd73e17be6f4673881f2a0dface0ecdd2472e3e /src/com/fourisland/fourpuzzle/window/ChoiceWindow.java
parent78f9af78f7966163791737741b0004568f8fdf50 (diff)
downloadfourpuzzle-7c8c6e2b37be39fbef4c168342fcdebc4ec58974.tar.gz
fourpuzzle-7c8c6e2b37be39fbef4c168342fcdebc4ec58974.tar.bz2
fourpuzzle-7c8c6e2b37be39fbef4c168342fcdebc4ec58974.zip
Added support for other System files
Because the coordinates and transparent color previously used were tuned for the default System file, the coordinates were changed to be more forgiving and the color is picked from the last pixel of the first row from the graphic.

Also, for some reason, every file in source control has been marked as modified, even though most haven't been. Don't know why this happened.
Diffstat (limited to 'src/com/fourisland/fourpuzzle/window/ChoiceWindow.java')
-rwxr-xr-x[-rw-r--r--]src/com/fourisland/fourpuzzle/window/ChoiceWindow.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java b/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java index bf7391e..40fff30 100644..100755 --- a/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java +++ b/src/com/fourisland/fourpuzzle/window/ChoiceWindow.java
@@ -73,7 +73,7 @@ public class ChoiceWindow {
73 Graphics2D g2 = cacheBase.createGraphics(); 73 Graphics2D g2 = cacheBase.createGraphics();
74 74
75 g2.drawImage(SystemGraphic.getMessageBackground(), 1, 1, TopLeft.getWidth()+getWidth()+TopRight.getWidth()-2, TopLeft.getHeight()+getHeight()+BottomLeft.getHeight()-2, null); 75 g2.drawImage(SystemGraphic.getMessageBackground(), 1, 1, TopLeft.getWidth()+getWidth()+TopRight.getWidth()-2, TopLeft.getHeight()+getHeight()+BottomLeft.getHeight()-2, null);
76 g2.drawImage(Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(temp.getSource(), new TransparentPixelFilter(-25600))), 0, 0, null); 76 g2.drawImage(Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(temp.getSource(), new TransparentPixelFilter(SystemGraphic.getTransparentColor().getRGB()))), 0, 0, null);
77 g2.setFont(g2.getFont().deriveFont(Font.BOLD)); 77 g2.setFont(g2.getFont().deriveFont(Font.BOLD));
78 78
79 int ty = TopLeft.getHeight()+g2.getFontMetrics().getHeight()-SPACER; 79 int ty = TopLeft.getHeight()+g2.getFontMetrics().getHeight()-SPACER;
@@ -86,10 +86,6 @@ public class ChoiceWindow {
86 tx += ((width/2)-(g2.getFontMetrics().stringWidth(choice)/2)); 86 tx += ((width/2)-(g2.getFontMetrics().stringWidth(choice)/2));
87 } 87 }
88 88
89 /* TODO The following code paints the text onto the window. However,
90 * when it paints the lowercase 'y', the tail is white, not the
91 * correct gradient. */
92
93 g2.setPaint(new TexturePaint(SystemGraphic.getTextColor(), new Rectangle(tx, ty, g2.getFontMetrics().stringWidth(choice),g2.getFontMetrics().getHeight()))); 89 g2.setPaint(new TexturePaint(SystemGraphic.getTextColor(), new Rectangle(tx, ty, g2.getFontMetrics().stringWidth(choice),g2.getFontMetrics().getHeight())));
94 g2.drawString(choice, tx, ty); 90 g2.drawString(choice, tx, ty);
95 91
@@ -113,5 +109,21 @@ public class ChoiceWindow {
113 { 109 {
114 return height; 110 return height;
115 } 111 }
112
113 int selected = 0;
114 public void moveUp()
115 {
116 selected--;
117 }
118
119 public void moveDown()
120 {
121 selected++;
122 }
123
124 public String getSelected()
125 {
126 return choices.get(selected);
127 }
116 128
117} 129}