[nbusers] Lookup Topcomponent

  • From: "Eric55" < >
  • To:
  • Subject: [nbusers] Lookup Topcomponent
  • Date: Fri, 30 Nov 2012 12:22:23 -0500

I'm trying to loosely couple 2 modules A and B using an interface (we will 
call interface).

A calls a method (setText) on the interface, B implements the interface.

A is currently using this code to lookup the module that implements the 
interface.

private interface bob;
...
bob = Lookup.getDefault().lookup(interface.class)

onButtonPress{
bob.setText("hi");
}

This works fine except both A and B are topComponents so they are created at 
startup.  Lookup then returns a new instance of B.  B isn't displaying the 
new data because the instance of B that is displayed isn't the same as the 
instance of B that A is sending the data too.

I'm missing something fundimental here.  I want to press the button on A and 
have "hi" show up in the textfield in B, then make C and display "hi" in some 
other way.  How do I get A to talk to the displayed instance of B.  AKA I 
need to lookup the currently created instance of B not create a new one.

Is there a way to register B with lookup?






[nbusers] Lookup Topcomponent

Eric55 11/30/2012

[nbusers] Re: Lookup Topcomponent

Benno Markiewicz 12/01/2012

[nbusers] Lookup Topcomponent

Eric55 12/03/2012

[nbusers] Lookup Topcomponent

ebaumann 12/04/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close