Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #37979 > unrolled thread
| Started by | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| First post | 2018-01-23 05:17 -0800 |
| Last post | 2018-01-23 09:55 -0500 |
| Articles | 14 — 4 participants |
Back to article view | Back to comp.lang.java.programmer
What's the difference between mouseClicked and mousePressed? Eric Douglas <e.d.programmer@gmail.com> - 2018-01-23 05:17 -0800
Re: What's the difference between mouseClicked and mousePressed? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-01-23 09:22 -0500
Re: What's the difference between mouseClicked and mousePressed? Eric Douglas <e.d.programmer@gmail.com> - 2018-01-23 06:35 -0800
Re: What's the difference between mouseClicked and mousePressed? Eric Douglas <e.d.programmer@gmail.com> - 2018-01-23 06:47 -0800
Re: What's the difference between mouseClicked and mousePressed? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-01-23 19:41 +0100
Re: What's the difference between mouseClicked and mousePressed? Eric Douglas <e.d.programmer@gmail.com> - 2018-01-23 11:03 -0800
Re: What's the difference between mouseClicked and mousePressed? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2018-01-23 14:06 -0600
Re: What's the difference between mouseClicked and mousePressed? Eric Douglas <e.d.programmer@gmail.com> - 2018-01-23 12:41 -0800
Re: What's the difference between mouseClicked and mousePressed? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2018-01-23 14:54 -0600
Re: What's the difference between mouseClicked and mousePressed? Eric Douglas <e.d.programmer@gmail.com> - 2018-01-23 13:11 -0800
Re: What's the difference between mouseClicked and mousePressed? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2018-01-23 15:18 -0600
Re: What's the difference between mouseClicked and mousePressed? Eric Douglas <e.d.programmer@gmail.com> - 2018-01-23 13:36 -0800
Re: What's the difference between mouseClicked and mousePressed? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2018-01-23 15:48 -0600
Re: What's the difference between mouseClicked and mousePressed? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-01-23 09:55 -0500
| From | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| Date | 2018-01-23 05:17 -0800 |
| Subject | What's the difference between mouseClicked and mousePressed? |
| Message-ID | <65e683ec-444d-4a80-b3b4-e6de98bacc5e@googlegroups.com> |
They appear to do the same thing, except you can't fire mouseClicked with touch events.
[toc] | [next] | [standalone]
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Date | 2018-01-23 09:22 -0500 |
| Message-ID | <p47gev$ns$1@dont-email.me> |
| In reply to | #37979 |
On 1/23/2018 8:17 AM, Eric Douglas wrote:
> They appear to do the same thing, except you can't fire mouseClicked with touch events.
Pressed fires when the mouse button goes down, Released and
Clicked fire when it goes back up again. Try this:
Mouse onto listening component
Press a button
W-a-i-t
Release the button
... and note the time stamps on the various events. You can also
play around with multiple buttons, sliding the mouse onto the
listening component with a button already down, and so on -- I'm
sure a little experimentation will clarify things. (Disclaimer:
I have no clue about Swing/AWT and touch devices.)
--
esosman@comcast-dot-net.invalid
One thousand ninety-three days to go.
[toc] | [prev] | [next] | [standalone]
| From | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| Date | 2018-01-23 06:35 -0800 |
| Message-ID | <46ceca25-eec6-41b4-b304-f5424800b9eb@googlegroups.com> |
| In reply to | #37980 |
On Tuesday, January 23, 2018 at 9:22:45 AM UTC-5, Eric Sosman wrote: > Pressed fires when the mouse button goes down, Released and > Clicked fire when it goes back up again. Try this: > > Mouse onto listening component > Press a button > W-a-i-t > Release the button > > ... and note the time stamps on the various events. You can also > play around with multiple buttons, sliding the mouse onto the > listening component with a button already down, and so on -- I'm > sure a little experimentation will clarify things. (Disclaimer: > I have no clue about Swing/AWT and touch devices.) > and if I'm looking for a double click / double tap event?
[toc] | [prev] | [next] | [standalone]
| From | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| Date | 2018-01-23 06:47 -0800 |
| Message-ID | <f7bbe8fe-e0b7-406b-9d72-5e1f0a99ee67@googlegroups.com> |
| In reply to | #37981 |
On Tuesday, January 23, 2018 at 9:36:07 AM UTC-5, Eric Douglas wrote: > > Mouse onto listening component > > Press a button > > W-a-i-t > > Release the button > > > > ... and note the time stamps on the various events. You can also > > play around with multiple buttons, sliding the mouse onto the > > listening component with a button already down, and so on -- I'm > > sure a little experimentation will clarify things. (Disclaimer: > > I have no clue about Swing/AWT and touch devices.) > > > > and if I'm looking for a double click / double tap event? I'm not seeing the point to mouseClicked since it doesn't appear to work with touch events and I'm testing our application on a Surface Pro. If I'm looking for single click I can use mouseReleased and for double click I can use mousePressed and get the same result? Oddly mouseClicked will only tell you if you got a single mousePressed immediately followed by a mouseReleased in the same location, but both of those events translate to touch events while mouseClicked does not?
[toc] | [prev] | [next] | [standalone]
| From | Daniele Futtorovic <da.futt.news@laposte.net> |
|---|---|
| Date | 2018-01-23 19:41 +0100 |
| Message-ID | <p47vlr$gob$1@dont-email.me> |
| In reply to | #37982 |
On 2018-01-23 15:47, Eric Douglas wrote: > On Tuesday, January 23, 2018 at 9:36:07 AM UTC-5, Eric Douglas wrote: > I'm not seeing the point to mouseClicked since it doesn't appear to work with touch events and I'm testing our application on a Surface Pro. If I'm looking for single click I can use mouseReleased and for double click I can use mousePressed and get the same result? > Oddly mouseClicked will only tell you if you got a single mousePressed immediately followed by a mouseReleased in the same location, but both of those events translate to touch events while mouseClicked does not? Check the Javadoc for java.awt.event.MouseEvent. Also, MouseEvent has a #getClickCount(). Might be what you're looking for. -- DF.
[toc] | [prev] | [next] | [standalone]
| From | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| Date | 2018-01-23 11:03 -0800 |
| Message-ID | <b38033da-d0ab-47ee-bc93-99c129edef98@googlegroups.com> |
| In reply to | #37985 |
On Tuesday, January 23, 2018 at 1:42:21 PM UTC-5, Daniele Futtorovic wrote: > > Also, MouseEvent has a #getClickCount(). Might be what you're looking for. > > -- > DF. You can do if (e.getClickCount()==2) in mousePressed, or mouseReleased, seems to accomplish the same double click event as if you used mouseClicked, except I don't see a way to get to mouseClicked with touch events.
[toc] | [prev] | [next] | [standalone]
| From | Knute Johnson <nospam@rabbitbrush.frazmtn.com> |
|---|---|
| Date | 2018-01-23 14:06 -0600 |
| Message-ID | <p484kh$nta$1@dont-email.me> |
| In reply to | #37986 |
On 1/23/2018 13:03, Eric Douglas wrote: > On Tuesday, January 23, 2018 at 1:42:21 PM UTC-5, Daniele Futtorovic wrote: >> >> Also, MouseEvent has a #getClickCount(). Might be what you're looking for. >> >> -- >> DF. > > You can do if (e.getClickCount()==2) in mousePressed, or mouseReleased, seems to accomplish the same double click event as if you used mouseClicked, except I don't see a way to get to mouseClicked with touch events. > Are you using a different API? Otherwise touch events are the same as mouse events. It could be however that your Surface Pro is too slow in propagating events and you never see click counts greater than 1. On my Acer touch screen and that JavaWS program from the Tutorial that Eric posted I can get click counts of 2 but I have to be fast :-). -- Knute Johnson
[toc] | [prev] | [next] | [standalone]
| From | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| Date | 2018-01-23 12:41 -0800 |
| Message-ID | <3ce5cf06-6cfa-4baf-b459-3751a6dcd195@googlegroups.com> |
| In reply to | #37987 |
On Tuesday, January 23, 2018 at 3:07:03 PM UTC-5, Knute Johnson wrote: > On 1/23/2018 13:03, Eric Douglas wrote: > > On Tuesday, January 23, 2018 at 1:42:21 PM UTC-5, Daniele Futtorovic wrote: > >> > >> Also, MouseEvent has a #getClickCount(). Might be what you're looking for. > >> > >> -- > >> DF. > > > > You can do if (e.getClickCount()==2) in mousePressed, or mouseReleased, seems to accomplish the same double click event as if you used mouseClicked, except I don't see a way to get to mouseClicked with touch events. > > > > Are you using a different API? Otherwise touch events are the same as > mouse events. It could be however that your Surface Pro is too slow in > propagating events and you never see click counts greater than 1. On my > Acer touch screen and that JavaWS program from the Tutorial that Eric > posted I can get click counts of 2 but I have to be fast :-). > > -- > > Knute Johnson I get the click counts, it processes double click from mousePressed or mouseReleased, I just can't get into the mouseClicked from the touch events (either from finger or pen). Now I see Oracle explains they did set up touch events as mouse events, a touch pressed = mouse pressed, with no mention of mouseClicked on that page. So it just doesn't appear they set up any way to generate it. https://docs.oracle.com/javase/8/javafx/events-tutorial/gestures.htm
[toc] | [prev] | [next] | [standalone]
| From | Knute Johnson <nospam@rabbitbrush.frazmtn.com> |
|---|---|
| Date | 2018-01-23 14:54 -0600 |
| Message-ID | <p487em$dfj$1@dont-email.me> |
| In reply to | #37988 |
On 1/23/2018 14:41, Eric Douglas wrote: > On Tuesday, January 23, 2018 at 3:07:03 PM UTC-5, Knute Johnson wrote: >> On 1/23/2018 13:03, Eric Douglas wrote: >>> On Tuesday, January 23, 2018 at 1:42:21 PM UTC-5, Daniele Futtorovic wrote: >>>> >>>> Also, MouseEvent has a #getClickCount(). Might be what you're looking for. >>>> >>>> -- >>>> DF. >>> >>> You can do if (e.getClickCount()==2) in mousePressed, or mouseReleased, seems to accomplish the same double click event as if you used mouseClicked, except I don't see a way to get to mouseClicked with touch events. >>> >> >> Are you using a different API? Otherwise touch events are the same as >> mouse events. It could be however that your Surface Pro is too slow in >> propagating events and you never see click counts greater than 1. On my >> Acer touch screen and that JavaWS program from the Tutorial that Eric >> posted I can get click counts of 2 but I have to be fast :-). >> >> -- >> >> Knute Johnson > > I get the click counts, it processes double click from mousePressed or mouseReleased, I just can't get into the mouseClicked from the touch events (either from finger or pen). > Now I see Oracle explains they did set up touch events as mouse events, a touch pressed = mouse pressed, with no mention of mouseClicked on that page. So it just doesn't appear they set up any way to generate it. > https://docs.oracle.com/javase/8/javafx/events-tutorial/gestures.htm > TouchEvents are JavaFX events not Swing. I thought you were using Swing? Did you try that JavaWS program that Eric S posted the link to? I get MouseEvents on my Acer touch screen with that. The click counts come from timing clicks over a period of time. The individual events are not changed. -- Knute Johnson
[toc] | [prev] | [next] | [standalone]
| From | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| Date | 2018-01-23 13:11 -0800 |
| Message-ID | <4740811d-907d-42c3-aefe-45189d3a1d57@googlegroups.com> |
| In reply to | #37989 |
On Tuesday, January 23, 2018 at 3:55:05 PM UTC-5, Knute Johnson wrote: > > TouchEvents are JavaFX events not Swing. I thought you were using > Swing? Did you try that JavaWS program that Eric S posted the link to? > I get MouseEvents on my Acer touch screen with that. The click counts > come from timing clicks over a period of time. The individual events > are not changed. > > -- > > Knute Johnson Yes I am processing touch events in Swing, no FX. I just googled "java mouse touch events" and that was the first relevant doc that came up. The first result was for swing which said nothing about touch. I thought that was the same? You can get into mouseClicked from a touch event? I couldn't get mine to work. Is it proximity? I was using mouseClicked for double clicks, and normally with a mouse you don't move the pointer between clicks, but with a finger or pen it can be hard to hit the exact same spot twice.
[toc] | [prev] | [next] | [standalone]
| From | Knute Johnson <nospam@rabbitbrush.frazmtn.com> |
|---|---|
| Date | 2018-01-23 15:18 -0600 |
| Message-ID | <p488r8$n11$1@dont-email.me> |
| In reply to | #37990 |
On 1/23/2018 15:11, Eric Douglas wrote: > On Tuesday, January 23, 2018 at 3:55:05 PM UTC-5, Knute Johnson wrote: >> >> TouchEvents are JavaFX events not Swing. I thought you were using >> Swing? Did you try that JavaWS program that Eric S posted the link to? >> I get MouseEvents on my Acer touch screen with that. The click counts >> come from timing clicks over a period of time. The individual events >> are not changed. >> >> -- >> >> Knute Johnson > > Yes I am processing touch events in Swing, no FX. I think that's the problem, there aren't any in Swing. -- Knute Johnson
[toc] | [prev] | [next] | [standalone]
| From | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| Date | 2018-01-23 13:36 -0800 |
| Message-ID | <751cc038-6f80-4eb4-9725-2af8d5a71ed1@googlegroups.com> |
| In reply to | #37991 |
On Tuesday, January 23, 2018 at 4:18:53 PM UTC-5, Knute Johnson wrote: > > > > Yes I am processing touch events in Swing, no FX. > > I think that's the problem, there aren't any in Swing. > > -- > > Knute Johnson If switching our Swing controls to JavaFX controls is possible it would be ugly. If Swing isn't supposed to handle the touch events, I don't know how they're converting. mousePressed and mouseReleased are getting called. I did find an old blog that says mouseClicked looks like a double tap, I'll have to test it again maybe tapping 4 times would process a mouseClicked double click. It does accept getClickCount()==2 from 2 taps in mousePressed or mouseReleased.
[toc] | [prev] | [next] | [standalone]
| From | Knute Johnson <nospam@rabbitbrush.frazmtn.com> |
|---|---|
| Date | 2018-01-23 15:48 -0600 |
| Message-ID | <p48aka$4v5$1@dont-email.me> |
| In reply to | #37992 |
On 1/23/2018 15:36, Eric Douglas wrote: > On Tuesday, January 23, 2018 at 4:18:53 PM UTC-5, Knute Johnson wrote: >>> >>> Yes I am processing touch events in Swing, no FX. >> >> I think that's the problem, there aren't any in Swing. >> >> -- >> >> Knute Johnson > > If switching our Swing controls to JavaFX controls is possible it would be ugly. > If Swing isn't supposed to handle the touch events, I don't know how they're converting. mousePressed and mouseReleased are getting called. I did find an old blog that says mouseClicked looks like a double tap, I'll have to test it again maybe tapping 4 times would process a mouseClicked double click. It does accept getClickCount()==2 from 2 taps in mousePressed or mouseReleased. > Try that JavaWS program that Eric S posted the link to. I get a mousePressed, mouseReleased and a mouseClicked just by touching the screen and lifting my finger. -- Knute Johnson
[toc] | [prev] | [next] | [standalone]
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Date | 2018-01-23 09:55 -0500 |
| Message-ID | <p47id3$dnv$1@dont-email.me> |
| In reply to | #37981 |
On 1/23/2018 9:35 AM, Eric Douglas wrote:
> On Tuesday, January 23, 2018 at 9:22:45 AM UTC-5, Eric Sosman wrote:
>> Pressed fires when the mouse button goes down, Released and
>> Clicked fire when it goes back up again. Try this:
>>
>> Mouse onto listening component
>> Press a button
>> W-a-i-t
>> Release the button
>>
>> ... and note the time stamps on the various events. You can also
>> play around with multiple buttons, sliding the mouse onto the
>> listening component with a button already down, and so on -- I'm
>> sure a little experimentation will clarify things. (Disclaimer:
>> I have no clue about Swing/AWT and touch devices.)
>>
>
> and if I'm looking for a double click / double tap event?
Do some experimenting. Write a simple test harness that reports
mouse events as they occur, or use one already written:
https://docs.oracle.com/javase/tutorial/uiswing/events/mouselistener.html
--
esosman@comcast-dot-net.invalid
One thousand ninety-three days to go.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web