Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable in a JTabbed panel  RSS feed

 
Jaunty John
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have written a CheckBook application using a JTable contained in a JFrame. Now, I would like to embed it in a tabbed panel. I cannot do this directly as a JFrame is a window, and the JTabbed component can only use a panel component (JPanel). First, can a JTable be embedded in a JPanel component? Second, can anyone direct me to some sample code to embed a JTable in a JTabbed panel?
Thanks in advance
jlbalder
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
don't think too complicated
[CODE]
JScrollPane scrollPane = new JScrollPane(myTable);
JTabbedPane tabPane = new JTabbedPane();
tabPane.add(scrollPane);
JFrame f = new JFrame();
f.getContentPane().add(tabPane, BorderLayout.CENTER);
[\CODE]
cheers
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"jlbalder" -

Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it here.

Thanks! and welcome to the JavaRanch!
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!