🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #10164

Re: Get width of JPopupMenu

#10164
From: Paul Furbacher [TeamB]
Date: Thu, 04 Nov 1999 00:00
17 lines
1202 bytes
David Sykes wrote:

> I have a JPopupMenu that I would like to place to the left of a given
> control. Unfortunately, all of the getSize(), getWidth(), getBounds()
> methods return a width of 0 before the menu is displayed.
> 
> Does anybody know of a way to get the width of the popup _BEFORE_ it is
> displayed?

I'm just guessing and don't have time to test this: JPopupMenu has
a public "pack()" method.  Try doing that and then get the size.
Packing may force the "realization" of the component: until a 
component has been realized and laid out, it doesn't have any
dimensions.


Paul Furbacher  (TeamB)
Technical Details
Message-ID: <38211CDA.15EBE343@bilbo.bio.purdue.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7vbpgd$osv4@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,49b67961a3be5cd1
X-Google-Attributes: gid111d45,public
From: "Paul Furbacher [TeamB]" <pf@bilbo.bio.purdue.edu>
Subject: Re: Get width of JPopupMenu
Date: 1999/11/04
Message-ID: <38211CDA.15EBE343@bilbo.bio.purdue.edu>
X-Deja-AN: 544266255
Content-Transfer-Encoding: 7bit
References: <7vbpgd$osv4@forums.borland.com>
Content-Type: text/plain; charset=us-ascii
Organization: Reverse Alchemy, Inc.
Mime-Version: 1.0
Reply-To: pf@bilbo.bio.purdue.edu
Newsgroups: borland.public.jbuilder.java.swing