(Graphics screen)
| 329 | |
| 330 | //public void paintComponent(Graphics screen) { |
| 331 | public void paint(Graphics screen) { |
| 332 | Dimension size = getSize(); |
| 333 | if ((size.width != sizeW) || (size.height != sizeH)) { |
| 334 | // component has been resized |
| 335 | offscreen = null; |
| 336 | } |
| 337 | |
| 338 | if (offscreen == null) { |
| 339 | sizeW = size.width; |
| 340 | sizeH = size.height; |
| 341 | buttonSize = sizeH; |
| 342 | offscreen = Toolkit.offscreenGraphics(this, sizeW, sizeH); |
| 343 | } |
| 344 | |
| 345 | Graphics g = offscreen.getGraphics(); |
| 346 | /*Graphics2D g2 =*/ Toolkit.prepareGraphics(g); |
| 347 | |
| 348 | g.setFont(font); |
| 349 | if (metrics == null) { |
| 350 | metrics = g.getFontMetrics(); |
| 351 | ascent = metrics.getAscent(); |
| 352 | } |
| 353 | |
| 354 | g.drawImage(bgImage[mode], 0, 0, sizeW, sizeH, this); |
| 355 | |
| 356 | rolloverState = ROLLOVER_NONE; |
| 357 | if (mouseX > sizeW - buttonSize && mouseX < sizeW) { |
| 358 | rolloverState = ROLLOVER_COLLAPSE; |
| 359 | |
| 360 | } else if (message != null && !message.isEmpty()) { |
| 361 | if (sizeW - 2*buttonSize < mouseX) { |
| 362 | rolloverState = ROLLOVER_CLIPBOARD; |
| 363 | |
| 364 | } else if (url != null && mouseX > LEFT_MARGIN && |
| 365 | // calculate right edge of the text for rollovers (otherwise the pane |
| 366 | // cannot be resized up or down whenever a URL is being displayed) |
| 367 | mouseX < (LEFT_MARGIN + g.getFontMetrics().stringWidth(message))) { |
| 368 | rolloverState = ROLLOVER_URL; |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | // https://github.com/processing/processing/issues/3265 |
| 373 | if (message != null) { |
| 374 | // font needs to be set each time on osx |
| 375 | g.setFont(font); |
| 376 | // set the highlight color on rollover so that the user's not surprised |
| 377 | // to see the web browser open when they click |
| 378 | g.setColor((rolloverState == ROLLOVER_URL) ? urlColor : fgColor[mode]); |
| 379 | g.drawString(message, LEFT_MARGIN, (sizeH + ascent) / 2); |
| 380 | } |
| 381 | |
| 382 | if (indeterminate) { |
| 383 | //int x = cancelButton.getX(); |
| 384 | //int w = cancelButton.getWidth(); |
| 385 | int w = Toolkit.getButtonWidth(); |
| 386 | int x = getWidth() - Math.max(RIGHT_MARGIN, (int)(buttonSize*1.2)) - w; |
| 387 | int y = sizeH / 3; |
| 388 | int h = sizeH / 3; |
nothing calls this directly
no test coverage detected