(Frame frame)
| 530 | List<Image> iconImages; |
| 531 | |
| 532 | protected void setProcessingIcon(Frame frame) { |
| 533 | // On OS X, this only affects what shows up in the dock when minimized. |
| 534 | // So replacing it is actually a step backwards. Brilliant. |
| 535 | if (PApplet.platform != PConstants.MACOS) { |
| 536 | //Image image = Toolkit.getDefaultToolkit().createImage(ICON_IMAGE); |
| 537 | //frame.setIconImage(image); |
| 538 | try { |
| 539 | if (iconImages == null) { |
| 540 | iconImages = new ArrayList<>(); |
| 541 | final int[] sizes = { 16, 32, 48, 64, 128, 256, 512 }; |
| 542 | |
| 543 | for (int sz : sizes) { |
| 544 | URL url = PApplet.class.getResource("/icon/icon-" + sz + ".png"); |
| 545 | Image image = Toolkit.getDefaultToolkit().getImage(url); |
| 546 | iconImages.add(image); |
| 547 | } |
| 548 | } |
| 549 | frame.setIconImages(iconImages); |
| 550 | |
| 551 | } catch (Exception ignored) { } // harmless; keep this to ourselves |
| 552 | |
| 553 | } else { // handle OS X differently |
| 554 | if (!dockIconSpecified()) { // don't override existing -Xdock param |
| 555 | // On OS X, set this for AWT surfaces, which handles the dock image |
| 556 | // as well as the cmd-tab image that's shown. Just one size, I guess. |
| 557 | URL url = PApplet.class.getResource("/icon/icon-512.png"); |
| 558 | // Seems dangerous to have this in code instead of using reflection, no? |
| 559 | //ThinkDifferent.setIconImage(Toolkit.getDefaultToolkit().getImage(url)); |
| 560 | try { |
| 561 | final String td = "processing.core.ThinkDifferent"; |
| 562 | Class<?> thinkDifferent = |
| 563 | Thread.currentThread().getContextClassLoader().loadClass(td); |
| 564 | Method method = |
| 565 | thinkDifferent.getMethod("setIconImage", Image.class); |
| 566 | method.invoke(null, Toolkit.getDefaultToolkit().getImage(url)); |
| 567 | } catch (Exception e) { |
| 568 | e.printStackTrace(); // That's unfortunate |
| 569 | } |
| 570 | } |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | |
| 575 | /** |
no test coverage detected