Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: how to create a JTabbedPane java?

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how to create a JTabbedPane java?

    hey

    i have an imageViewer and i want to change the imagePanel into a TabbedPane so i can have more than one image open at the same time but have each of them in a different tab and be able to add and remove the tabs as well.

    what i have:

    private ImagePanel imagePanel; //<< i tried to change the ImagePanel to JTabbedPane but it doesn't work and it gives error in other parts of the codes that i have.

    // Create the image pane in the center
    imagePanel = new ImagePanel();
    imagePanel.setBorder(new EtchedBorder());
    contentPane.add(imagePanel, BorderLayout.CENTER);


    the code above is for the image pane where the image is displayed.
    is it possible to change the image pane to a tabbedPane without changeing other bits in the code?
    i have looked at alot of tabbedpane examples but i don't know how to combine the code with my code to get it to work but i did put a few code examples into my program but the frame changes to tabbedpane and not the image pane where the image is displayed. i want to change the inner frame to tabbed not the actual frame of the program.
    any suggestions on how should i go about it or if you can show me a simple example that could work.

    thank you


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,296
    Thanks
    180
    Thanked 824 Times in 767 Posts
    Blog Entries
    5

    Default Re: how to create a JTabbedPane java?

    See How to Use Tabbed Panes (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)
    If I understand the situation, just add the ImagePanel's to the JTabbedPane. I recommend if you need more help than this, break the problem down to the essentials and post an SSCCE, asking specific questions related to the code.

    EDIT:
    This thread has been cross posted here:

    http://www.java-forums.org/awt-swing/42304-how-create-jtabbedpane-java.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting

    Last edited by copeg; April 12th, 2011 at 09:03 PM.

  3. #3
    Junior Member
    Join Date
    Apr 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how to create a JTabbedPane java?

    i have looked at that tutorial but when i implement the code the outer frame changes to tabbed pane and the buttons that i have on the frame disappeares and this is not what i want. but i'll go and try to add the imagePanel to the Jtabbedpane and i'll post a message to let you know what i've done.

    on the cross-post matters i would like to apologise for this i didn't know that the fourms are linked and i didn't mean to break any sort of rules of the forum.

Similar Threads

  1. Bold font in JTabbedpane in Nimbus L&F
    By sponarun in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 28th, 2011, 01:09 AM
  2. How I can create those shapes with Java?
    By Learner in forum AWT / Java Swing
    Replies: 3
    Last Post: November 18th, 2010, 01:10 AM
  3. [SOLVED] How to close all tabs in JTabbedPane?
    By LeonLanford in forum AWT / Java Swing
    Replies: 7
    Last Post: June 28th, 2010, 10:58 AM
  4. Replies: 3
    Last Post: April 14th, 2010, 07:33 PM
  5. traversing multiple jTabbedPane?
    By dewboy3d in forum AWT / Java Swing
    Replies: 3
    Last Post: October 2nd, 2009, 07:26 PM

Tags for this Thread