Article View: borland.public.jbuilder.java.swing
Article #9742Re: Zero values returned for getX( ), getY( ), getSize( ) and getLocation( ) - Why?
From: Johan Forsberg
Date: Fri, 14 Jan 2000 00:00
Date: Fri, 14 Jan 2000 00:00
14 lines
1327 bytes
1327 bytes
Jeff Marendo <marendoj@commos.com> skrev i diskussionsgruppsmeddelandet:85i9cb$5q27@bornews.borland.com... > I need to get the X and Y locations of various components (in relation to > where they are in their appropriate container) when an object of my class > first becomes instantiated. I also need their sizes. I've been trying to > call JComponent functions getX( ), getY( ), getSize( ), and getLocation( ) > from within jbInit( ) to get the values for any particular component, but I > keep getting return values of 0. Is this b/c jbInit( ) hasn't finished > executing or hasn't exited yet? Almost. The layoutmanagers don't do 'their stuff' until you call validate() or pack() (on the frame).
Technical Details
Message-ID:
<85ml2f$8lg24@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<85i9cb$5q27@bornews.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,10a4f12cdbe9765b X-Google-Attributes: gid111d45,public From: "Johan Forsberg" <jfo@SPAM_SPAM_EGGS_SPAMstmf.se> Subject: Re: Zero values returned for getX( ), getY( ), getSize( ) and getLocation( ) - Why? Date: 2000/01/14 Message-ID: <85ml2f$8lg24@bornews.borland.com> X-Deja-AN: 572470010 References: <85i9cb$5q27@bornews.borland.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing