Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] How to access Swing components in a SWT EMBEDDED composite

Hi,

To get a list of all components in a Swing Component
or Eclipse Composite, we can use code like below to do
the job.
public void getAllComponents(Component c, Collection
collection) {
  collection.add(c);
  if (c instanceof Container) {
    Component[] kids = ((Container)c).getComponents();
    for(int i=0; i<kids.length; i++)
      getAllComponents(kids[i], collection);
  }
}

but if I embedd some Swing component inside SWT
composite like the
Snippet135(http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet135.java?rev=HEAD&content-type=text/vnd.viewcvs-markup)
on Eclipse Swt page, how can I list all the AWT/Swing
objects?

Thanks in advance!

John (Zuokun) Zhang
2005-12-08


Back to the top