(Graphics screen)
| 200 | } |
| 201 | |
| 202 | public void paintComponent(Graphics screen) { |
| 203 | Dimension size = getSize(); |
| 204 | if ((size.width != sizeW) || (size.height != sizeH)) { |
| 205 | // component has been resized |
| 206 | |
| 207 | if ((size.width > imageW) || (size.height > imageH)) { |
| 208 | // nix the image and recreate, it's too small |
| 209 | offscreen = null; |
| 210 | |
| 211 | } else { |
| 212 | // who cares, just resize |
| 213 | sizeW = size.width; |
| 214 | sizeH = size.height; |
| 215 | setButtonBounds(); |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | if (offscreen == null) { |
| 220 | sizeW = size.width; |
| 221 | sizeH = size.height; |
| 222 | setButtonBounds(); |
| 223 | imageW = sizeW; |
| 224 | imageH = sizeH; |
| 225 | offscreen = createImage(imageW, imageH); |
| 226 | } |
| 227 | |
| 228 | Graphics2D g = Theme.setupGraphics2D(offscreen.getGraphics()); |
| 229 | g.setColor(BGCOLOR[mode]); |
| 230 | g.fillRect(0, 0, imageW, imageH); |
| 231 | g.setColor(FGCOLOR[mode]); |
| 232 | |
| 233 | g.setFont(font); // needs to be set each time on osx |
| 234 | int ascent = g.getFontMetrics().getAscent(); |
| 235 | assert message != null; |
| 236 | g.drawString(message, Preferences.GUI_SMALL, (sizeH + ascent) / 2); |
| 237 | |
| 238 | screen.drawImage(offscreen, 0, 0, null); |
| 239 | } |
| 240 | |
| 241 | private void initialize() { |
| 242 | cancelButton = new JButton(I18n.PROMPT_CANCEL); |
nothing calls this directly
no test coverage detected