()
| 467 | |
| 468 | |
| 469 | protected void initIcons() { |
| 470 | IOUtil.ClassResources res; |
| 471 | if (PJOGL.icons == null || PJOGL.icons.length == 0) { |
| 472 | // Default Processing icons |
| 473 | final int[] sizes = { 16, 32, 48, 64, 128, 256, 512 }; |
| 474 | String[] iconImages = new String[sizes.length]; |
| 475 | for (int i = 0; i < sizes.length; i++) { |
| 476 | iconImages[i] = "/icon/icon-" + sizes[i] + ".png"; |
| 477 | } |
| 478 | res = new ClassResources(iconImages, |
| 479 | PApplet.class.getClassLoader(), |
| 480 | PApplet.class); |
| 481 | } else { |
| 482 | // Loading custom icons from user-provided files. |
| 483 | String[] iconImages = new String[PJOGL.icons.length]; |
| 484 | for (int i = 0; i < PJOGL.icons.length; i++) { |
| 485 | iconImages[i] = resourceFilename(PJOGL.icons[i]); |
| 486 | } |
| 487 | |
| 488 | res = new ClassResources(iconImages, |
| 489 | sketch.getClass().getClassLoader(), |
| 490 | sketch.getClass()); |
| 491 | } |
| 492 | NewtFactory.setWindowIcons(res); |
| 493 | } |
| 494 | |
| 495 | |
| 496 | private String resourceFilename(String filename) { |
no test coverage detected