Select the next tab of a panel in java

Posted on 2011-04-26
Last Modified: 2013-12-14
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.
Question by:mn202
    LVL 47

    Expert Comment

    LVL 47

    Accepted Solution

    if this is instance of JTabbedPane
    will open new tab
    so with Next button you want to
    cal getSelectedIndex(),  increemnt index
    and call setSelectedIndex(int)
    LVL 47

    Expert Comment

    You probably want to check if the index does not reach
     getTabCount() and if it does  go back to tab number 0

    Author Comment

    Yes, that did it! Thank you very much, I was a bit stuck there.
    LVL 47

    Expert Comment

    You are always welcome

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Receive file in Servlet 1 28
    strDist challenge 35 71
    json format text only 4 51
    Starting to learn JAVA, 7 37
    How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from ( Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
    Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
    This video teaches viewers about errors in exception handling.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now