aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes how to write switch command in changelistener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to write switch command in changelistener" Watch "how to write switch command in changelistener" New topic
Author

how to write switch command in changelistener

pooja prabhu
Ranch Hand

Joined: Sep 23, 2012
Posts: 33
Can anyone tell me how to write switch command between tabs in StateChanged of ChangeListener...
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4544
    
    5

1. Java doesn't have commands. Java has statements. The cases in a switch statement must be compile time constants, numeric up to Java 6; Java 7 introduced switching on String values.
2. Let's see what you've tried, in the form of an SSCCE <- link as that will help us to understand what exactly you're trying to achieve; 'switch command between tabs' probably makes sense to you, since you know what you're trying to do, but it's rather incomprehensible to me.


luck, db
There are no new questions, but there may be new answers.
pooja prabhu
Ranch Hand

Joined: Sep 23, 2012
Posts: 33
If i select 1st tab then one query should execute ....if 2nd then 2nd query and so on.....so wat will you suggest....how can i achieve that....
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4544
    
    5

You can switch on getSElectedIndex(). But I strongly urge you to separate database handling code from your GUI.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to write switch command in changelistener