|
Author |
Topic: mouse buttons (right and middle) (Read 3082 times) |
|
Sjeiti
|
mouse buttons (right and middle)
« on: Mar 12th, 2005, 12:40pm » |
|
Hi... I would like more control. Is there a way to detect the right mouse button?... and if there is, what the about the middle mouse button (down and scroll)? gr... ...Sjeiti
|
http://www.sjeiti.com/
|
|
|
Sjeiti
|
Re: mouse buttons (right and middle)
« Reply #2 on: Mar 13th, 2005, 2:39pm » |
|
ah.. thanks... (now why didn't I find that?... I always search before asking)
|
http://www.sjeiti.com/
|
|
|
mflux
|
Re: mouse buttons (right and middle)
« Reply #3 on: Mar 13th, 2005, 10:38pm » |
|
Still no search results on mouse wheel. Google searches have been wierd at best... Code: void mouseWheelMoved(MouseWheelEvent e) { int notches = e.getWheelRotation(); if(notches!=0) println(notches); } |
| What the hell do you input for e when you call the function The website doesn't say...
|
|
|
|
liminal
|
Re: mouse buttons (right and middle)
« Reply #4 on: Mar 14th, 2005, 6:13pm » |
|
In Java1.4 and higher there is an interface called MouseWheelListener. To listen for mouse wheel motion, you would implement the interface in your class and register your class with another class that notifies of mouse wheel movement (typically, this would be any subclass of java.awt.Component such as BApplet). So if you're using java 1.4 or 1.5, you could have a sketch like this: Code: class MyClass implements java.awt.event.MouseWheelListener { public MyClass(java.awt.Component comp) { comp.addMouseWheelListener(this); } public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) { ... } } |
| or if you're doing everything directly in your BApplet class you can add an anonymous inner class as an adaptor: Code: setup() { addMouseWheelListener(new java.awt.event.MouseWheelListener() { public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) { ... } }); } |
|
|
|
|
|
gll
|
Re: mouse buttons (right and middle)
« Reply #5 on: Mar 22nd, 2005, 7:03pm » |
|
It works well! Thx liminal. Here's an example: http://ingallian.design.uqam.ca/goo/P55/ImageExplorer/ --I had problems with IExplorer, but it works well in Opera and FireFox.
|
guillaume LaBelle
|
|
|
gll
|
Re: mouse buttons (right and middle)
« Reply #6 on: Mar 24th, 2005, 12:37am » |
|
I've just tried on a Mac with Firefox. I just forgot that there's no wheel! Firefox on MAC is crashing, But it work with Safari.
|
guillaume LaBelle
|
|
|
|