Re: Good practise?
- From: "Rhino" <no.offline.contact.please@xxxxxxxxxx>
- Date: Mon, 17 Jul 2006 08:40:15 -0400
"Gargoyle" <nobody@xxxxxxxxxxxxxx> wrote in message
news:1pomb2lm8d9df33cg6a0og49p36ebs6rkm@xxxxxxxxxx
New to coding in Java.
I have a constructor that sets up a JFrame with panels, buttons, etc. and
I
want to disable some of the buttons when the frame first appears.
I will also need to disable selected controls during further processing,
probably using a purpose-built method.
I know how to do this.
Don't want to start a heated debate over this but...
My question: is it acceptable programming practise to invoke my
purpose-built
method from within a constructor?
I don't see why it would be a problem to invoke a method that enables or
disables GUI controls from a constructor. I've done so many times and have
no regrets.
Then again, I've never had the particular code examined by an OO design guru
so maybe such an activity violates a design precept of some kind.
To my way of thinking, the constructor's job is to build an instance of an
object. If that object is a GUI, then I don't see why enabling/disabling
controls on that GUI should be avoided within the constructor.
--
Rhino
.
- Follow-Ups:
- Re: Good practise?
- From: Daniel Dyer
- Re: Good practise?
- References:
- Good practise?
- From: Gargoyle
- Good practise?
- Prev by Date: Re: A file writing dilemma....!
- Next by Date: Re: A file writing dilemma....!
- Previous by thread: Good practise?
- Next by thread: Re: Good practise?
- Index(es):