Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 577
  • Last Modified:

Select the next tab of a panel in java

Hi everyone, I am new to java and would appreciate some help.I have created an application with net beans that includes a jtabbedpanel and  has 3 panels . The user is supposed to fill in some information in the first panel then move to the the second panel and finally to the third.My question is what code should I include in the "next button" so that the user the user doesn't have to move between tabs manually. Thank you in advance.
0
mn202
Asked:
mn202
  • 4
1 Solution
 
for_yanCommented:
if this is instance of JTabbedPane
then
setSelectedIndex(int)
will open new tab
so with Next button you want to
cal getSelectedIndex(),  increemnt index
and call setSelectedIndex(int)
0
 
for_yanCommented:
You probably want to check if the index does not reach
 getTabCount() and if it does  go back to tab number 0
0
 
mn202Author Commented:
Yes, that did it! Thank you very much, I was a bit stuck there.
0
 
for_yanCommented:
You are always welcome
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now