I'm currently using the Netbeans platform and can't seem to get one TopComponent to communicate with another. My research has pointed me in the direction of using Lookups however I can't seem to access my function.
I have one TopComponent called AppleTopComponent, which has a method called myName() and I want to call it from my OrangeTopComponent开发者_开发知识库, which is called within a button handler, inside that handler I have the following code.
TopComponent tc = WindowManager.getDefault().findTopComponent("AppleTopComponent");
Lookup tcLookup = tc.getLookup();
tcLookip.myName();
Surely this should be a simple process, what is it I'm doing wrong.
Many thanks, Alex
This should do what you're looking for.
    TopComponent tc = WindowManager.getDefault().findTopComponent("AppleTopComponent");
    AppleTopComponent atc = (AppleTopComponent) tc;
    jLabel1.setText(atc.myName());
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论