Re: popupmenu and JTable question

"Hello, it's Krishna" <[email protected]>
Newsgroups gmane.comp.embedded.carlsbad-cubes
Message-ID <[email protected]>
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()));
     }
};
   
    public Object[][] getData1() {
        Object[][] data = new String[2][3];

        data[0][0] = new String("1");
        data[0][1] = new String("DT1");
        data[0][2] = new String("S1");

        data[1][0] = new String("2");
        data[1][1] = new String("DT2");
        data[1][2] = new String("S2");

        return data;
    }
    public Object[] getColumnNames1() {
        Object[] colNames = new String[3];

        colNames[0] = new String("No.");
        colNames[1] = new String("Document Type");
        colNames[2] = new String("Status");

        return colNames;
    }

// ... code here ...

    private MyTest() {
        swix = new SwingEngine(this);

        try {
            swix.render( "xml/myTest.xml"
).setVisible( true );
        } catch (Exception e) {
            e.printStackTrace();
        }

        tabbedpane.addChangeListener(this);
    }
}

--- Frank_Meißner <[email protected]> wrote:
> Hello, it's Krishna wrote:
> > I have the following in my xml file.
> > 
> > <frame>
> > <menubar>
> >   <menu name="Message">
> >     <menuitem name="Incoming" />
> >     <menuitem name="Outgoing"
> icon="icons/right.gif"
> > />
> >        <popupmenu>
> >           <menuitem name="Normal" />
> >           <menuitem name="Special" />
> >        </popupmenu>
> >     <separator />
> >     <menuitem name="Exit" />
> >   </menu>
> >   <menu name="Import/Export">
> >     <menuitem name="Incoming" />
> >     <separator />
> >     <menuitem name="Outgoing" />
> >   </menu>
> > <menubar>
> > <tabbedpane
> titles="Outgoing,Incoming,Subscriptions">
> >   <panel>
> >     <table id="table1" ShowHorizontalLines="true"
> > ShowVerticalLines="true">
> >     </table>
> >   </panel>
> >   <panel>
> >     ...
> >   </panel>
> >   <panel>
> >     ...
> >   </panel>
> > </tabbedpane>
> > </frame>
> > 
> > Question(s):
> > -----------
> > a)  Am I using the popupmenu right? It doesn't
> semm
> >     to show up.
> 
> No. IMHO the popumenu is wrong there. Usually, you
> show a popup menu as 
> a response to a mouse click event, preferable on the
> position of the 
> click. From the labels you gave, perhaps you want to
> use 
> JCheckboxMenuItem (Swixml: checkboxmenuitem)? If you
> really want to use 
> a popup menu, define it with swixml and use the
> attribute "id" to get 
> access to the popup menu from your program.
> 
> 
> > b)  The table tag creates an empty "panel". I
> believe
> >     I need to populate it with (initial) data.
> > However,
> >     even after I tried that, I donot see any data.
> >     Again, what did I miss here.
> 
> How did you do that? Hint: Did you use a TableModel?
> 
> 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
> 
> 
> 
> _______________________________________________
> Forum mailing list
> [email protected]
>
http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
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.