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

JFrame design question  RSS feed

 
Andreas Sandberg
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Folks,

I'm creating a Java App using swing and had a quick question. Does it make more sense when creating a frame to extend the JFrame class or to create a new JFrame object in the constructor of the class that will provide the gui? I don't need to extend any other classed by this gui class so I'm not worried about that but rather what makes sense from a strictly OOP design viewpoint? By extending the JFrame class I should be creating a more specific JFrame class. However, I'm not really adding any functionality (technically), I'm just painting some objects. Thanks for your input.

Andreas
 
todd runstein
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you just answered your own question - you're not adding any functionality, so why would you extend it?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!