Dear Community,

I am writing about the use of Lookups in Netbeans Platform. I never struggled so much to do something so simple in my entire life. I have read over 100 tutorials and web pages but either they are too difficult or assume you know how to use Netbeans Platform.

My situation is rather simple. All I want is to call a repaint method in Module B when Module A does something. And Vice Versa!
I have an API module which I put a singleton class in too.

Here is the code I have

Java Code:
public final class WaveBarTopComponent extends TopComponent implements LookupListener {
  private Lookup.Result<String> result;
  private InstanceContent ic;

  public WaveBarTopComponent() {
    ic = new InstanceContent();
    associateLookup(new AbstractLookup(ic));
  }

  public void componentOpened() {
    result = Utilities.actionsGlobalContext().lookupResult(String.class);
    result.addLookupListener(this);
  }

  public void componentClosed() {
    result.removeLookupListener(this);
  }

  //... When I click on a panel ...
  ic.add("pnlSignWaveMousePressed_1");
  //...

  public void resultChanged(LookupEvent le) {
    if (!result.allInstances().isEmpty()) {
      String data = result.allInstances().iterator().next();
      pnlSignWave.repaint();
      ic.remove(data);
    }
  }
}
This is identical to both modules and it works! If I replace the code in resultChanged to a JOptionMessage it works twice but I can't understand how this is working and I cannot understand why it sometimes doesn't trigger the repaint or the fill (because in the other module I have a list)

Thanks
Desperate