Urgent JTabbedPane Help !!!!!!!!!!!

Hi everybody,

I have a big problem, I'm getting a line under my tab when adding the pane in a borderlayout. All I nedd is to see only tabs so I set the size so that I can only see my tabs, but it shows me a line all the way and I don't want this line to appear. Here is a piece of code for reference to compile and see the line that I want to get rid of.

# start of example

import javax.swing.event.*;

import javax.swing.*;

import javax.swing.border.Border;

import java.awt.*;

import java.awt.event.*;

public class TabbedPaneDemo extends JPanel {

public TabbedPaneDemo() {

JTabbedPane tabbedPane = new JTabbedPane();

tabbedPane.setBorder( BorderFactory.createEmptyBorder ( 0, 0, 0, 0 ) );

tabbedPane.setPreferredSize( new Dimension( 100, 23 ) );

JPanel panel1 = new JPanel();

panel1.setBorder( BorderFactory.createEmptyBorder ( 0, 0, 0, 0 ) );

tabbedPane.addTab("TAB 1", panel1);

//Add the tabbed pane to this panel.

this.setLayout(new BorderLayout());

this.add(tabbedPane, BorderLayout.NORTH);

}

public static void main(String[] args) {

JFrame frame = new JFrame("TabbedPaneDemo");

frame.addWindowListener(new WindowAdapter() {

public void windowClosing(WindowEvent e) {System.exit(0);}

});

frame.getContentPane().add(new TabbedPaneDemo(),

BorderLayout.CENTER);

frame.setSize(400, 125);

frame.setVisible(true);

}

}

# end of the example

if you compile and run the above example you'll see what line I am talking about. I'll really appreciate for any help I am stuck with this for a week now and no luck so far. Any help is appreciated. Thanks

[1761 byte] By [jenna2] at [2007-9-26 7:05:33]
# 1
It looks different if you change tothis.add(tabbedPane, BorderLayout.CENTER);Don't know if it is different enough for you.
DrClap at 2007-7-1 16:44:50 > top of Java-index,Archived Forums,Swing...
# 2
Yes I know it looks different when I saythis.add(tabbedPane, BorderLayout.CENTER);but I want to put it in the North and don't want to have that line being shown.
jenna2 at 2007-7-1 16:44:50 > top of Java-index,Archived Forums,Swing...
# 3
What is the point of using a BorderLayout if you are only going to use the North portion?
DrClap at 2007-7-1 16:44:50 > top of Java-index,Archived Forums,Swing...
# 4
because I have some other stuff to show in other portions and therefore I need a BorderLayout only, I don't want to use other layouts.
jenna2 at 2007-7-1 16:44:50 > top of Java-index,Archived Forums,Swing...
# 5
I've tried your program. If will look fine once you actually put something in the JTabbedPane.
chuanhaochiu at 2007-7-1 16:44:50 > top of Java-index,Archived Forums,Swing...
# 6
yes, but let's say I don't want to put anything in the tab. How can I get rid of that line.
jenna2 at 2007-7-1 16:44:50 > top of Java-index,Archived Forums,Swing...
# 7
tabbedPane.setBorder( orderFactory.createEmptyBorder ( 0, 0, 0, 0 ) );tabbedPane.setPreferredSize( new Dimension( 100, 23 ) );and the whole point of the above code is to just see the tab only.
jenna2 at 2007-7-1 16:44:50 > top of Java-index,Archived Forums,Swing...
# 8
tabbedPane.setBorder( orderFactory.createEmptyBorder ( 0, 0, 0, 0 ) );tabbedPane.setPreferredSize( new Dimension( 100, 23 ) );and the whole point of the above code is to just see the tab only.
jenna2 at 2007-7-1 16:44:50 > top of Java-index,Archived Forums,Swing...
# 9
tabbedPane.setBorder( orderFactory.createEmptyBorder ( 0, 0, 0, 0 ) );tabbedPane.setPreferredSize( new Dimension( 100, 23 ) );and the whole point of the above code is to just see the tab only.
jenna2 at 2007-7-1 16:44:50 > top of Java-index,Archived Forums,Swing...
# 10
Are you saying you only want the tabs of the JTabbedPane?Maybe you can let us in on what you're trying to accomplish?
chuanhaochiu at 2007-7-1 16:44:50 > top of Java-index,Archived Forums,Swing...
# 11
yes I just want the tabs only as you can see from the example that I do get the tabs only but the line I don't like it how can I get rid of it.
jenna2 at 2007-7-1 16:44:50 > top of Java-index,Archived Forums,Swing...
# 12
did you ever get this to work? I am trying to do the same thing but everytime I add a new tab the bar gets bigger? any ideas?
jewen at 2007-7-1 16:44:50 > top of Java-index,Archived Forums,Swing...