Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1617
| From | "bcr666" <bcr666@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: How to know when does |
| Message-ID | <1178938059.312869.32150@q75g2000hsh.googlegroups.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <1178876544.944041.88940@q75g2000hsh.googlegroups.com> |
| Date | 2011-04-27 15:34 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui
You say you have tabs. I assume you are using a JTabbedPane. I would
make the content in each of the tabs its own class that implements an
interface.
public interface TreeWidget {
public void loadTree(Object parameter);
}
public class TabPanelA implements TreeWidget {
JTree tvwTreeA = new JTree(new DefaultTreeModel(new
DefaultMutableTreeNode("Root")));
... // other stuff here
public void loadTree(Object parameter) {
... // stuff here to load tree
}
}
public class MyFrame extends JFrame {
JButton cmdLoad = new JButton("Load");
JTabbedPane tabbedPane = new JTabbedPane();
public MyFrame() {
this.setSize(800, 600);
this.setVisible(true);
this.getContentPane().setLayout(new BorderLayout());
this.getContentPane().add(cmdLoad, BorderLayout.NORTH);
this.getContentPane().add(tabbedPane, BorderLayout.CENTER);
tabbedPane.addTab("Panel A", new TabPanelA());
cmdLoad.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Object parameter = ...// parameter to pass to the tree
((TreeWidget)tabbedPane.getSelectedComponent()).loadTree(parameter);
}
});
}
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to know when does a J lichuan.nj@gmail.com.remove-dii-this - 2011-04-27 15:34 +0000
Re: How to know when does "visionset" <visionset@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
Re: How to know when does "bcr666" <bcr666@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
Re: How to know when does lichuan.nj@gmail.com.remove-dii-this - 2011-04-27 15:34 +0000
csiph-web