Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #31017 > unrolled thread
| Started by | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| First post | 2015-02-02 20:29 +0100 |
| Last post | 2015-02-10 19:54 +0100 |
| Articles | 6 — 4 participants |
Back to article view | Back to comp.lang.java.programmer
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
| From | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| Date | 2015-02-02 20:29 +0100 |
| Subject | JPopupMenu |
| Message-ID | <877fw0yuwm.fsf@Equus.decebal.nl> |
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?
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
[toc] | [next] | [standalone]
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Date | 2015-02-02 14:46 -0500 |
| Message-ID | <maok53$3ou$1@dont-email.me> |
| In reply to | #31017 |
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
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2015-02-02 15:01 -0500 |
| Message-ID | <54cfd7ae$0$293$14726298@news.sunsite.dk> |
| In reply to | #31017 |
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? Here I get the popup menu fine as soon as I right click on the applet. Arne
[toc] | [prev] | [next] | [standalone]
| From | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| Date | 2015-02-03 01:05 +0100 |
| Message-ID | <87386nzwov.fsf@Equus.decebal.nl> |
| In reply to | #31020 |
Op Monday 2 Feb 2015 21:01 CET schreef Arne Vajhøj: > 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? > > Here I get the popup menu fine as soon as I right click on the > applet. I tried that and I get the same result. But that is not what I want. I was using the wrong class. It looks like that with JComboBox I get what I want. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2015-02-05 13:34 -0800 |
| Message-ID | <rco7dapetjkctunosehf1kctm6rhcjv7fj@4ax.com> |
| In reply to | #31017 |
On Mon, 02 Feb 2015 20:29:13 +0100, Cecil Westerhof <Cecil@decebal.nl> wrote, quoted or indirectly quoted someone who said : > >The JTextField is shown, but the JPopupMenu not. What is wrong in the >code? I have not looked at your code, but a popup is not supposed to display until you invoke the pop up function. Perhaps you just wanted an plain JMenu see http://mindprod.com/jgloss/jmenu.html for sample code -- Roedy Green Canadian Mind Products http://mindprod.com To solve an interesting problem, start by finding a problem that is interesting to you. ~ Eric S. Raymond (born: 1957-12-04 age: 57)
[toc] | [prev] | [next] | [standalone]
| From | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| Date | 2015-02-10 19:54 +0100 |
| Message-ID | <87twytwqal.fsf@Equus.decebal.nl> |
| In reply to | #31053 |
Op Thursday 5 Feb 2015 22:34 CET schreef Roedy Green: > On Mon, 02 Feb 2015 20:29:13 +0100, Cecil Westerhof > <Cecil@decebal.nl> wrote, quoted or indirectly quoted someone who > said : > >> >> The JTextField is shown, but the JPopupMenu not. What is wrong in >> the code? > > I have not looked at your code, but a popup is not supposed to > display until you invoke the pop up function. Perhaps you just > wanted an plain JMenu JComboBox did what I wanted. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web