Article View: borland.public.jbuilder.java.language
Article #16584Re: beginners java lang questions
From: Steve Horsley
Date: Thu, 28 Jan 1999 00:00
Date: Thu, 28 Jan 1999 00:00
28 lines
1684 bytes
1684 bytes
I would also add that in this case, it is essential to call a function
rather than just set the property - the button then has other work to
do (like repainting, maybe resizing).
In Delphi, as steve says, you can arrange that setting a property
automatically calls a function. I java, that's no true. The property
'Label' itself has been protected specifically to force you to use the
"setter" function which also does the other housekeeping.
//--------------
Steve Schafer (TeamB) wrote:
<snip>
> >2. why cant properties of components be accessed directly eg cant say:
> > buttonControl1.Label="some text"
> >have to say:
> > buttonControl1.setLabel("some text")
>
> Because Java isn't Delphi. :) In languages like Delphi and Visual
> Basic, an attempt to set a property:
>
> MyButton.Caption := 'Some text';
>
> actually causes the invocation of a method (SetCaption in this case).
> The only difference with Java is that this method invocation is
> explicit, and doesn't happen magically behind the scenes.
>
> -Steve
Technical Details
Message-ID:
<36B04632.6A16@cwcom.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36af90c4.1869276@forums.borland.com> <36bbc0ab.15986372@90.0.0.40>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,41acd0212bd83621 X-Google-Attributes: gidf74b3,public From: Steve Horsley <steve.horsley@cwcom.co.uk> Subject: Re: beginners java lang questions Date: 1999/01/28 Message-ID: <36B04632.6A16@cwcom.co.uk> X-Deja-AN: 437894799 Content-Transfer-Encoding: 7bit References: <36af90c4.1869276@forums.borland.com> <36bbc0ab.15986372@90.0.0.40> Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Reply-To: steve.horsley@cwcom.co.uk Newsgroups: borland.public.jbuilder.java.language