Updating to NBMs from NetBeans 8.0.1 as some of them are required to run on JDK8
1 package org.apidesign.extensibleicon;
3 import java.awt.Component;
4 import java.awt.Graphics;
5 import java.io.IOException;
6 import org.openide.util.Lookup;
7 import org.openide.util.lookup.AbstractLookup;
8 import org.openide.util.lookup.InstanceContent;
10 // BEGIN: ext.modifiable.icon
11 public final class ModifiableIcon implements ExtIcon {
12 // AbstractLookup is helper implementation
13 // so that people do not need to write its own
14 // lookup from scratch
15 private AbstractLookup lookup;
16 // InstanceContent is interface that gives
17 // "creator of the lookup" more rights, like
18 // ability to modify the content
19 private InstanceContent ic;
22 ic = new InstanceContent();
23 lookup = new AbstractLookup(ic);
26 public Lookup getLookup() {
30 public void markModified() {
31 if (lookup.lookup(ModifiedImpl.class) == null) {
32 ic.add(new ModifiedImpl());
36 private final class ModifiedImpl implements Modified {
37 public void save() throws IOException {
41 public void discard() throws IOException {
45 // FINISH: ext.modifiable.icon
47 public void paintIcon(Component c, Graphics g, int x, int y) {
48 g.fillRect(x, y, 16, 16);
51 public int getIconWidth() {
55 public int getIconHeight() {