This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to write switch command in changelistener

 
pooja prabhu
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me how to write switch command between tabs in StateChanged of ChangeListener...
 
Darryl Burke
Bartender
Posts: 5126
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
pooja prabhu
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5126
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can switch on getSElectedIndex(). But I strongly urge you to separate database handling code from your GUI.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic