Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

JTabbedPane problem

I have a JFrame with a menubar and a JTabbedPane.  The user specifies how many tabs there will be and what they will be named, and then the tabs are created, each tab containing a JTextField and a JTable.  However, the tabs look distorted.  Any idea what is happening?  Why the text and graphics look distorted?  I'm using addTab to create the tabs.  Also, lets say the user creates n tabs, how can I access JTable n?  Thanks.
0
abstractionz
Asked:
abstractionz
  • 4
  • 4
1 Solution
 
objectsCommented:
define distorted
0
 
objectsCommented:
> Also, lets say the user creates n tabs, how can I access JTable n?

use a wrapper panel for you tabs

public class TabPanel extends JPanel
{
   public JTable getTable()
   ...

And add instances of TabPanel to your tabbed pane, and use getComponentAt() method to access them
0
 
abstractionzAuthor Commented:
members.aol.com/abstractionz/images/tabs.jpg

that's a screenshot of what is happening.  
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
objectsCommented:
that doesn't look to healthy does it.
can u post your code.
or better a still a working example that I can run here
0
 
abstractionzAuthor Commented:
It's code taken straight from the book 'Java Swing' by O'Reilly:

public class SimpleTab extends JFrame {
      JTabbedPane jtp;
      
      public SimpleTab(){
            super("JTabbedPane");
            setSize(200,200);
            Container contents = getContentPane();
            jtp = new JTabbedPane();
            jtp.addTab("Tab1", new JLabel("This is Tab One"));
            jtp.addTab("Tab2", new JButton("This is Tab Two"));
            jtp.addTab("Tab3", new JCheckBox("This is Tab Three"));
            contents.add(jtp);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setVisible(true);
      }
      public static void main(String[] args) {
            new SimpleTab();
      }
}
0
 
objectsCommented:
works fine here
win2k, 1.4
0
 
abstractionzAuthor Commented:
strange.  i am running winxp pro sp1, 1.4
0
 
abstractionzAuthor Commented:
anybody else have this problem?
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now