File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting tab on JTabbedPane that exists already

 
James Howerton
Ranch Hand
Posts: 82
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
How can I add a tab to a JTabbedPane that exist?
NullPointer
This method adds tabs to a JTabbedPane but I need it to add the tab to a
JTabbedPane that was created at startup in the SetObjects class.
 
Rob Spoor
Sheriff
Pie
Posts: 20396
47
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our GUI forum.
 
James Howerton
Ranch Hand
Posts: 82
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to use the Interface Runnable here?

my tabs are loading with a hard coded Array now.

if it is a sound practice
I am working on classes that will use a list and kind of update that array so it will have different elements added or removed.

additionally, If I create a class to r/w that list and maintain a properties.properties will this allow the same tabs to load when I restart the program?

finally, Is it possible to make the panels that load into the tabpane serializable so I can look them up using properties or will the load on the tabbed panels automatically?

>
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you're still working on this problem

> How can I add a tab to a JTabbedPane that exist?
> NullPointer

you have as a class field
public JTabbedPane jTabbedPaneObj;

and in obj(), you have this
JTabbedPane jTabbedPaneObj = new JTabbedPane();

if you try to access jTabbedPaneObj from elsewhere in your code, it will be null

change
JTabbedPane jTabbedPaneObj = new JTabbedPane();
to
jTabbedPaneObj = new JTabbedPane();
 
James Howerton
Ranch Hand
Posts: 82
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Runnable,serializable,and Collections are cool but I'll have to go with the desktopPane solution.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic