Page 2 of 2 FirstFirst 12
Results 21 to 23 of 23
  1. #21
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default Re: reference variable to JFrame

    That's how I used to be too, and actually it was someone at one of these Java forums that pointed out how unnecessary extending JFrame by default was.

    Another downside to using extends when really you need composition is this: now that I work on software development teams at work, if I see somebody else's code extending a JFrame (or JPanel, or whatever), my immediate assumption is that they must have changed some behavior of the component (otherwise why would they extend it, right?). Then I have to go looking through their code to make sure they haven't futzed with the size or visibility or what-have-you before I use it. If they had just favored composition in the first place, I wouldn't have that ambiguity.
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

  2. #22
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Rep Power

    Default Re: reference variable to JFrame

    Thanks, the moral of it all is: there is not just one way to do things?

  3. #23
    jim829 is online now Senior Member
    Join Date
    Jan 2013
    Northern Virginia, United States
    Rep Power

    Default Re: reference variable to JFrame

    Actually, there are many ways of doing something. But relatively few correct ways.

    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Reference Variable
    By shaunythesheep in forum New To Java
    Replies: 4
    Last Post: 12-18-2013, 06:48 PM
  2. Checking if a reference variable is empty.
    By BigBlueBuffalo in forum New To Java
    Replies: 11
    Last Post: 04-09-2013, 10:14 AM
  3. reference variable or an attribute value
    By agater in forum New To Java
    Replies: 1
    Last Post: 04-23-2012, 11:49 AM
  4. Reference variable
    By lala in forum New To Java
    Replies: 2
    Last Post: 02-03-2011, 08:27 PM
  5. static variable /pass by reference
    By katturv in forum New To Java
    Replies: 15
    Last Post: 10-03-2010, 08:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts