Re: Using TabbedPane
[email protected] Thu, 3 Mar 2005 13:24:34 -0600
| Newsgroups | gmane.comp.embedded.carlsbad-cubes |
|---|---|
| Message-ID | <AF4CBD49C827BA4F9BDD00E297CD804803884094@adsms01.dyn.datasys.swri.edu> |
Looks like you need another panel reference, say panel1 and panel2.
Or... You could give the panels different ids and use the find method.
panel = ((JPanel) swingEngine.find("myPanel"))
Or... You could use getAllComponentItertor() to get an Iterator and step through each component.
"Bruno Lima" <[email protected]> wrote in message news:<[email protected]>...
Hi Everyone!
I´m creating a simple app. I have a frame
that contains a tabbedpane with two tabs. As they are complexed panels, i separeted into 3 xml files.
- main.xml ( frame with tabbedpane )
- tab1.xml ( panel )
- tab2.xml ( panel )
Now, i was wondering how to put it all together. I tryied two ways. Only one work out. The first one, i got the tab as a component: I declared public JTabbedPane at top of the class. Then, after load the frame, i render the TAB1.xml and add the objetc it returns to the tabbedpane. Here is the code:
public FrameExampleEngine() throws Exception{
xmlEngine.render(FILE_XML_FRAME).setVisible(true);
loadTabs();
}
private void loadTabs() throws Exception {
JPanel panel;
panel = (JPanel)xmlEngine.render(FILE_XML_TAB_1);
tab_option.add(panel);
panel = (JPanel)xmlEngine.render(FILE_XML_TAB_2);
tab_option.add(panel);
}
This one works fine. But i dont think its a good way. First because i cant access the components from TAB1, cause the last render file was TAB2.
So i tried this
private void loadTabs() throws Exception {
xmlEngine.insert(FILE_XML_TAB_ASSOCIADOS, tab_option);
xmlEngine.insert(FILE_XML_TAB_PAGAMENTOS, tab_option);
}
Wich did not work. I guess its work in someway, but i couldn´t find where. I read the API to find somethin about, but nothing.
--
Bruno R. Lima
----------