Quick NetBeans RCP Tip: How to reuse an already open TopComponent instead of creating a new one.
Posted by kalali on August 6, 2009 at 4:21 AM EDT
Well, NetBeans RCP is a flagship product of NetBeans Project which the famous NetBeans IDE is based on it. To reuse an already opened TopComponent in an RCP application we can use a code similar to following listing, Assume that the TopComponent name is ContractorInfoTopComponent and we want to reuse the already opened tab instead of creating a new one.
Set tset = WindowManager.getDefault().getRegistry().getOpened();
for (TopComponent t : tset) {
if (t instanceof ContractorInfoTopComponent) {
ContractorInfoTopComponent citc = (ContractorInfoTopComponent) t;
citc.requestActive();
}
}
NetBeans RCP is the answer to creating complex and large scale swing applications in a modular way.
Related Topics >>
Blog Links >>
- Login or register to post comments
- Printer-friendly version
- kalali's blog
- 1640 reads





