Re: popupmenu and JTable question

Frank Meißner <[email protected]>
Newsgroups gmane.comp.embedded.carlsbad-cubes
Message-ID <[email protected]>
Hello, it's Krishna wrote:
> Frank,
> 
> Thank you for the quick response. I should have known
> better to get the popupmenu to show as an event
> response. No, I donot want a checkboxmenuitem. It's 
> a simple behavior similar to traversing a set of
> menuitems of a menu where some of them have further
> "sub" menuitems.
> 
> On the JTable, here's what I have. Please bear with
> the code since it's an initial quick test. However,
> the table isn't populated and/or not showing right.
> Please let me know, if you have other alternatives.
> 
> public class MyTest extends WindowAdapter implements
> ChangeListener {
> 
> // ... some code here ...
> 
> public void stateChanged(ChangeEvent e) {
>     System.out.println("tabChanged: " +
> tabbedpane.getSelectedIndex());
>      // 2 happens to be my third pane!
>      // @ToDo: remove the hard code!
>      if (2 == tabbedpane.getSelectedIndex()) {
>          tabel5 = new JTable(new
> DefaultTableModel(getData2(), getColumnNames2()));
>      }
> };
>    
Here is the problem: you create a new jtable instead of using the one 
you defined using swixml.

Ok, here is the solution: after creating the SwingEngine se and a call 
to se.render(...) (you must have done so already), call
JTable table1 = (JTable) se.getIdMap().get("table1");
Now continue with table1.setModel(new DefaultTableModel(...)). At the 
moment, you create a JTable without placing it somewhere (in an outer 
container, wherever).

I think you get the idea...

Frank

-- 
AuthentiDate International AG
Großenbaumer Weg 6
40472 Düsseldorf / Germany
Phone   : +49(0)211 43 69 89-0
FAX     : +49(0)211 43 69 89-19

TÜV Akademie
Kosten senken durch IT-Sicherheit
12.-13. Nov., Köln

Erfahren Sie mehr unter:
www.authentidate.de
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.