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
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
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.