Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #31019
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: JPopupMenu |
| Date | Mon, 02 Feb 2015 14:46:06 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 23 |
| Message-ID | <maok53$3ou$1@dont-email.me> (permalink) |
| References | <877fw0yuwm.fsf@Equus.decebal.nl> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Mon, 2 Feb 2015 19:45:39 +0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="bd4e1cba8d8592bec5d5ed9e4537fbfd"; logging-data="3870"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bwrLl1XnBLcTwXL9A/mLh" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
| In-Reply-To | <877fw0yuwm.fsf@Equus.decebal.nl> |
| Cancel-Lock | sha1:2hn3IO3w4Ow9DdJ3QqdsUFhVORM= |
| Xref | csiph.com comp.lang.java.programmer:31019 |
Show key headers only | View raw
On 2/2/2015 2:29 PM, Cecil Westerhof wrote:
> I tried the code at:
> http://www.java2s.com/Code/Java/Swing-JFC/CreatingpopupmenuswithSwing.htm
>
> The JTextField is shown, but the JPopupMenu not. What is wrong in the
> code?
My guess is that the isPopupTrigger() method returns false, perhaps
because the system's/browser's UI doesn't report it as such. In more
modern Java (the code is from a thirteen-year-old book ...) there's a
different, component-specific method: JPopupMenu.isPopupTrigger()
instead of MouseEvent.isPopupTrigger().
It's also worth noting (probably not involved with your problem, but
one never knows) that the example constructs Swing components in code
that does not execute on the Event Dispatch Thread (EDT). In technical
jargon, this is known as a "No-No." See
http://docs.oracle.com/javase/tutorial/uiswing/concurrency/dispatch.html
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
JPopupMenu Cecil Westerhof <Cecil@decebal.nl> - 2015-02-02 20:29 +0100
Re: JPopupMenu Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-02-02 14:46 -0500
Re: JPopupMenu Arne Vajhøj <arne@vajhoej.dk> - 2015-02-02 15:01 -0500
Re: JPopupMenu Cecil Westerhof <Cecil@decebal.nl> - 2015-02-03 01:05 +0100
Re: JPopupMenu Roedy Green <see_website@mindprod.com.invalid> - 2015-02-05 13:34 -0800
Re: JPopupMenu Cecil Westerhof <Cecil@decebal.nl> - 2015-02-10 19:54 +0100
csiph-web