Results 1 to 2 of 2
  1. #1
    Ami
    Ami is offline Member
    Join Date
    Feb 2012
    Posts
    26
    Rep Power
    0

    Default Putting the content (code) for each tab into a different class

    Hi,

    My application has a few tabs. It's getting hectic having the code for all tabs in a single class. So I decided to move the code for each tab into a separate class.

    So now I have a class that represents the main window.

    I put the code for each tab into a new class which extends JPanel.

    I was hoping that I could add the tabs to the tabbedPane in my main window class like this:

    .
    .
    tabbedPane.add("first tab", new FirstTab());

    tabbedPane.add("second tab", new SecondTab());
    .
    .
    (Where FirstTab and SecondTab are the name of the classes that have the code for thaose tabs).


    This approach isnt't working; the tabs get displayed but nothing gets displayed onto the tabs.

    Any help would be appreciated

    Thank you

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    5

    Default Re: Putting the content (code) for each tab into a different class

    Should work! Can you show us an example? Are you sure that you have components added to the panels?

Similar Threads

  1. Replies: 1
    Last Post: 01-26-2012, 07:11 PM
  2. I need help with putting a logo on my code
    By MikeJ39 in forum New To Java
    Replies: 13
    Last Post: 10-22-2011, 01:10 AM
  3. Replies: 5
    Last Post: 09-27-2011, 07:02 PM
  4. Repair source code content....!!!
    By khoilh in forum New To Java
    Replies: 2
    Last Post: 10-03-2009, 12:51 AM
  5. Putting code together.
    By newbee in forum New To Java
    Replies: 3
    Last Post: 04-17-2008, 03:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •