This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Swing + Cardlayout + what is the best way to program the panels

 
Federico Techera
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I'm learging with a real life program that I need.

Now I have the Swing toolbar with icons, and each icon call to a different panel using Cardlayout.

Now I need to code what every panel need to do.

What is the normal way to do this?

1) Coding every panel inside the same aplication and the same Swing GUI...

or

2) Coding every panel like one individual piece of code, by example a standard jpanel.. and when the code is right copy and paste or import the code inside the real application?

Thanks
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Typically you would create different .java files extending JPanel
e.g.

Then you would create instances of these panels and use them in your card layout
e.g.


Recommended reading http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html
 
Federico Techera
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:Typically you would create different .java files extending JPanel
e.g.


Thanks a lot Maneesh! I will try the weekend and then inform here my results
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic