Mercurial > hg > ristipolku
comparison game/IDMButton.java @ 163:dda7152d2402
Perform scaling of button widgets.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 01 Mar 2017 12:53:45 +0200 |
parents | e8eeac403e5f |
children | 32b1c41e194a |
comparison
equal
deleted
inserted
replaced
162:e8eeac403e5f | 163:dda7152d2402 |
---|---|
82 | 82 |
83 if (metrics == null) | 83 if (metrics == null) |
84 metrics = g.getFontMetrics(font); | 84 metrics = g.getFontMetrics(font); |
85 | 85 |
86 int textWidth = metrics.stringWidth(text); | 86 int textWidth = metrics.stringWidth(text); |
87 g.drawImage(img, getScaledX() + xoffs, getScaledY() + yoffs, null); | 87 g.drawImage(img, |
88 getScaledX() + xoffs, getScaledY() + yoffs, | |
89 getScaledWidth(), getScaledHeight(), | |
90 null); | |
88 | 91 |
89 g.setFont(font); | 92 g.setFont(font); |
90 g.setPaint(Color.black); | 93 g.setPaint(Color.black); |
91 g.drawString(text, | 94 g.drawString(text, |
92 getScaledX() + xoffs + (getScaledWidth() - textWidth) / 2, | 95 getScaledX() + xoffs + (getScaledWidth() - textWidth) / 2, |