Mouse wheel events aren't caught in browser
Hello.
I developed an applet with NetBeans 6.5 with mouse wheel zooming. In applet viewer everything works fine, but when I start applet in page in browser (I tried Firefox 3.0.6, MS IE 6.0, MS IE 7.0), no mouse wheel events (neither scrolling) are caught by applet.
Any ideas?
Thanks.
The reason behind this is: When applet is run on web browser, the applet window does not get focus. If you can grab the focus somehow, mouse wheel events will work fine. However, this works fine in applet viewer and in older versions of JDK. This is broken in JDK 1.6 and already fixed in JDK 1.7. Please have a look into this bug:
[http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6516675|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6516675]
If you run following applet in your browser you will see mouse wheel events in action with JDK1.6:
[In case it does not work, click on 'Click Me' button and try]
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
* @author mrityunjoy_saha
public class TestApplet extends JApplet {
public void init() {
setLayout(new BorderLayout());
XPane xPane = new XPane();
//xPane.requestFocus();
JScrollPane pane = new JScrollPane(xPane);
//add(new JButton("Click Me"), BorderLayout.NORTH);
add(pane, BorderLayout.CENTER);
class XPane extends JPanel {
private JLabel jLabel1;
public XPane() {
jLabel1 = new javax.swing.JLabel();
addMouseWheelListener(new java.awt.event.MouseWheelListener() {
public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
formMouseWheelMoved(evt);
jLabel1.setText("Mouse Wheel Info...");
add(jLabel1);
private void formMouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
jLabel1.setText(String.valueOf(evt.paramString()));
}Thanks,
Mrityunjoy
Similar Messages
-
Mouse wheel events are being caught by Photoshop document
I'm using CSXSWindowedApplication.
If you create any document in Photoshop, then zoom into it, so it takes more space than visible screen area and then open a CS Extension panel - the mouse wheel event is being caught by Photoshop and when you're rolling it, Photoshop moves document up and down, instead. mouseWheel events don't reach neither WindowedApplication nor any control inside of it.
This only happens in Photoshop.
Are there any workarounds?
Thank you!Interesting. I've' not played with mouse wheel events. I'll have a look at it.
Thanks
Bob -
Discussion Event aren't caught
1. Scenario
We would like to catch some events on specific "discussion documents",
which are saved in folders of own cm repository (Pls pay attention: we won't discuss on a resource or folder). For this reason we
created own repository service and assigend them to our repository.
This service should catch discussion events wich are fired during work
with it. Therefore we registrated our service as IResourceEventReceiver
and assigned them to Events "NEW_DISCUSSION" and "NEW_DISCUSSION_ITEM".
2. Problem
This EventReceiver aren't never be executed as long as new discussion
are created or modified.
3. Question
Are there any workaround to assign own repository service as discussion
event handler.
Thanks & Regards
Thomas BörnerThe reason behind this is: When applet is run on web browser, the applet window does not get focus. If you can grab the focus somehow, mouse wheel events will work fine. However, this works fine in applet viewer and in older versions of JDK. This is broken in JDK 1.6 and already fixed in JDK 1.7. Please have a look into this bug:
[http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6516675|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6516675]
If you run following applet in your browser you will see mouse wheel events in action with JDK1.6:
[In case it does not work, click on 'Click Me' button and try]
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
* @author mrityunjoy_saha
public class TestApplet extends JApplet {
public void init() {
setLayout(new BorderLayout());
XPane xPane = new XPane();
//xPane.requestFocus();
JScrollPane pane = new JScrollPane(xPane);
//add(new JButton("Click Me"), BorderLayout.NORTH);
add(pane, BorderLayout.CENTER);
class XPane extends JPanel {
private JLabel jLabel1;
public XPane() {
jLabel1 = new javax.swing.JLabel();
addMouseWheelListener(new java.awt.event.MouseWheelListener() {
public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
formMouseWheelMoved(evt);
jLabel1.setText("Mouse Wheel Info...");
add(jLabel1);
private void formMouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
jLabel1.setText(String.valueOf(evt.paramString()));
}Thanks,
Mrityunjoy -
How to fire mouse wheel events to parent container?
Hi,
When I create a JPanel (let's say jParent) inside a JScrollPane and this JPanel is larger than the current viewport I can use my mouse wheel to scroll the JPanel's containt without coding anything about that.
But if I add another JPanel-derived component (let's say jChild) to the first JPanel, mouse wheel events are not received by the first JPanel when the mouse is over the new added child JPanel.
How can I forward child's mouse wheel events to the first JPanel?
If I use:
jChild.addMouseWheelListener(jParent)I must implement a mouseWheelMoved() method in jParent that requires some code to work while it was doing it byitself before...
Thanks in advance for any help :-)
Regards,
Lara.you have a mouseWheelListener added to jChild?
if so, in the mouseWheelMoved code include this line
jParent.dispatchEvent(mouseWheelEvent);//or to the scrollpane -
Hello Everyone
I am using Datagrid in my Canvas.
I use mouse wheel to scroll the datagrid. But in one scroll
through that wheel make the more than 4 rows to be scroll.
So Now my requirement is to control the delta value of mouse
wheel event and how to use that with my datagrid so that i will
able to scroll one row through mouse wheel scroller.
Thanksplease give me some suggestion around it.
I want to scroll one row of datagrid with per mousewheel
scroll. I am not getting how to use the scrollMouseWheelMultiplier
property of the IConfiguration class because i am not able to
create the object of this class.
I am using the Flex 3.0 and flash 9 version.
please help me out around this. -
Mouse wheel event coordinates issue in LV2013
I realized some unexpected behavior when using the mouse wheel event of an XYGraph:
The event contains the mouse coordinates which should be relative to the origin of the pane according to the LabVIEW help (see Mouse Wheel (Control Event)). In my case these coordinates are shifted. At the same time, the coordinates returned by the Mouse Move and Mouse Down events are correct. I think the Mouse Move, Mouse Down and Mouse Wheel Event coords should all be the same, i.e. relative to the owning pane's origin? The graph is in a window divided by splitters. I am using LabVIEW 2013 Professional Development System.Hi maxicon,
I tried to reproduce your described behavior - It works as expected (see the attached VI).
Please try to reproduce the issue again with the attached VI.
1. Move the mouse and see coords changing.
2. Operate the mouse wheel and see the coords are the same.
P.S. Zero-coordinates are marked in the frontpanel:
Kind regards,
Heinz
Attachments:
Mouse Wheel Coords.vi 10 KB -
JWindow blocking mouse wheel event?
I have created a custom JPanel that acts as a container for another custom component that needs to receive mouse wheel events. When I place the custom JPanel in a JWindow the mouse wheel events do not get invoked, all though other mouse events work just fine. If I place the JPanel in a JFrame the mouse wheel events are invoked just fine (along with other mouse events).
To keep things simple the JPanel handles the mouse listeners. Any idea why it would work when in a JFrame but not a JWindow?
Edited by: skip1899 on Sep 21, 2009 7:20 AMThe below sample code exhibits the behavior I am talking about on my system (1.6.0_16 on XP). Does it work for you? Is there something I am missing?
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import javax.swing.JFrame;
import javax.swing.JWindow;
public class TestWindow extends JWindow implements
MouseWheelListener,MouseListener {
public TestWindow() {
setSize(200,200);
addMouseWheelListener(this);
addMouseListener(this);
public static void main(String args[]) {
JFrame frame = new JFrame();
frame.setSize(300,300);
frame.setVisible(true);
TestWindow win = new TestWindow();
win.setVisible(true);
public void mouseWheelMoved(MouseWheelEvent e) {
System.out.println("Mouse Wheel Moved!");
public void mouseClicked(MouseEvent arg0) {
System.out.println("Mouse Clicked!");
public void mouseEntered(MouseEvent arg0) {
System.out.println("Mouse Entered!");
public void mouseExited(MouseEvent arg0) {
System.out.println("Mouse Exited!");
public void mousePressed(MouseEvent arg0) {
System.out.println("Mouse Pressed!");
public void mouseReleased(MouseEvent arg0) {
System.out.println("Mouse Release!");
-
Scrolling with mouse wheel in column browser starts from the start of the list
Hi, I'm wondering if anyone else has been encountering this problem with iTunes.
Ever since updating to 10.5, whenever I use the mouse wheel to scroll in the column browser, it starts from the start of the list, regardless of which artist or album is highlighted.
For instance, I press the M key to jump to artists starting with M, then use the mouse wheel to scroll down the list, in iTunes 10.5 it jumps me back to the As.
The strange thing is that if I then use the mouse wheel to scroll down to the Cs, then jump down the list via a key press, mouse wheel scrolling will start me back to where I last scrolled (C).
How can I fix this problem?
I'm using iTunes 10.5.0.142 on Windows 7 Home Premium.I can confirm the behaviour. It would seem iTunes is keeping a separate record of the position in the list for use by the scroll wheel, and then snapping to that before scrolling up or down a screenful. The same random jumps happen if you use the keyboard Page Up/Page Down commands and then use the mouse wheel.
I shall file a bug report.
tt2 -
Why mouse wheel not working on browser ( Mac OS X) ?
at mac system, mouse wheel can't work on browser (
Safari、Firefox ), but it can work on single flash player.
it's mean the mac version flash player is support mouse
wheel, but can't work on browser.
somebody can tell me why? and how to fix this problem.very thanks for LuigiL.
i know this way, but it's not a good way. i must do
"addEventListener( MouseEvent.MOUSE_WHEEL" for all components if i
need use wheel...
i think single flash player can support, why browser can't ?
the problem is browser or OS ? can adobe contact apple to fix this
problem? or next version flash player can fix? -
Why is it that some Flash plug-ins eat up the mouse wheel
events and some don't.
By eat it up I mean taking the event from the browser and
processing it itself.
Example of plug-ins that do eat up the mouse wheel:
http://www.mediacollege.com/flash/media-player/720x360/demo.html
http://www.swffix.org/swfobject/testsuite/test_com.html
Example of plug-ins that don't eat up the mouse wheel:
http://flowplayer.org/
http://www.swffix.org/swfobject/testsuite/test_api_createswf.html
I have not been able to find any reason why these two differ
and how. Please help.
Thanks!>>
http://www.swffix.org/swfobject/testsuite/test_com.html
The page isn't long enough to scroll so the mosue wheel
wouldn't do anything
anyway.
>>
http://www.mediacollege.com/flash/media-player/720x360/demo.html
That has a mouse-wheel scrollable component, used to display
the files on
the left - that is likely capturing the event.
And on any of them, simply clicking outside the Flash, to
give the page the
focus, will allow the mouse wheel to work as you expect.
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
JScrollPane - Set the rate of the mouse wheel for scrolling
Hi,
I'm curious to know a little more about the mouse wheel used for scrolling in a JScrollPane. I'm using it for a JTextComponent at the moment, but the scroll rate is really slow.
Is this because of the way swing deals with the mouse wheel, and therefore can I increase the rate of scroll?
Or is it to do with the native OS and the way it processes mouse wheel events?
Cheers,
DavidHey John,
Scroll rate has nothing to do with the OS you'll be glad to know. As far as Swing goes, it doesn't in this case make any assumptions on how you want you 'views' to scroll.
I think LookAndFeel implementations often decide on default behaviour - I suppose this is in essence the whole point of the pluggable LnF framework.
Anyway, JTextComponent is an abstract class so I would not be surprised if it performs like a lame duck! You will however notice that it implements the Scrollable interface. Take a look at Scrollable.getScrollableBlockIncrement() and Scrollable.getScrollableUnitIncrement().
Overriding these methods will give you the behaviour you desire.
Warm regards,
Darren B -
MapViewer mouse wheel support?
Hi all,
I'd like to know whether MapViewer has javascript support for mouse wheel events. I would like to implement mouse wheel zooming however the api does not have an "onMouseWheel" event for a MVMapView component. Another way to do this would be to add mouse wheel support to the page, and then use "onMouseOver" and "onMouseOut" events to determine whether the cursor is over the map or not, however these events also don't seem to be supported. Any ideas would be much appreciated. Thanks.As it turns out their is inbuilt support for mouse wheel zooming but for some reason it doesn't appear to be included in the supplied java API documentation. This command is all that is required: mapview.setMouseWheelZoomEnabled(true)
-
Remmina not transmitting mouse wheel to VNC session
Hi,
I have just noticed that remmina is not transmitting mouse wheel events to VNC session. Never tried RDP, so I don't know if this is also affected.
First question: Is it only on my system or a general problem on Arch ?
If it is a general problem on Arch ...
I did a bit research abot this subject area, and I found some bug reports in multiple distros, but they are all marked as solved. So I think that it is fixed upstream. Otherwise the distros could not mark it as solved, right ?
If the package maintainer should read this ... is there a plan to update this package in near future ?
Thanks and Regards,
MarkusUsability bugs. The most annoying one was the size of the remmina window that was "never" right. And clicking the "1" button (top left) did unpredictable things. In most cases the window was maximised to full screen height leaving black bars above and below. The bug seems to appear less and less. I promise I will file a bug when I experience it again :-)
Crashes were always rare in my case.
But here's not the right place to lament around. -
I'm using Flex 4 and I've noticed something annoying with the spark HSlider: if I click the slider, it seems to retain focus so that even if the mouse is not over it, moving the mouse wheel up or down still causes the slider to move left or right.
I'd actually prefer that my slider not respond to mouse wheel events at all, but preventDefault() doesn't seem to work in this case. How can I get an HSlider to ignore mouse wheel events???
Thanks,
RobSublcass HSlider and include this code
override protected function system_mouseWheelHandler(event:MouseEvent):void
// DO NOT DELETE THIS FUNCTION
// leave blank to remove wheel scrolling on sliders -
Change the amout a scroll bar moves when user uses the mouse wheel?
hi,
i have a JScrollPane, and when a user uses the "wheel" on the mouse, it seems to move up/down 1 line at a time...i would like it to scroll faster basically...so that when the "wheel", the scroll bars move up/down like 5 lines at a time....is there some way to set this value, or how can i do it?
thanksIt looks like it behaves just like if the user had clicked the up or down arrow on the scrollbar, so
I would suggest setting the unit increment on the vertical scroll bar to be 5X its current value. Of
course, this would also increase the amount that gets scrolled when the user clicks on the up
or down arrow. If you don't want that, you'd need to somehow only change the increment on a
mouse wheel event, do the scroll, then change it back. My guess is that you'll need to provide
your own look and feel class to do that.
: jay
Maybe you are looking for
-
Long time to load data from PSA to DSO -Sequential read RSBKDATA_V
Hi , It is taking long time to load data from PSA to DSO. It is doing Sequential read on RSBKDATA_V and table contents no data . we are at - SAPKW70105. It started since yesterday . There is no changes in system parameters. Please advice. Thanks Nil
-
I have a table and cols as below: START DATE TOTAL DAYS 10/11/2011 15:00 1 10/15/2011 5:00 1 12/22/2011 10:00 1 12/22/2011 11:00 2 12/30/2011 10:00 1 1/1/2012 1:00 1 1/1/2012 10:00 1 1/1/2012 16:00 2 1/2/2012 14:
-
Any way to set "active mode" for FTP, or to use sFTP instead?
I have a web host that does not support passive FTP mode. I need to either set the mode to be "active mode", or I need to use secure FTP (sFTP). Is there any support for either of these within Muse?
-
Hello, When I look at the "Runtime Heap Summary" in JProbe (which shows memory usage) and compare it with graphs plotted in excel using GC output they look completely different. Using the GC output I plotted the before and after memory graphs and nei
-
Hi All, I need to get the start date and end date of a month by passing parameter like 'MAy-2011' Result should be start date - 01-MAY-2011 and end date - 31-MAY-2011 thnxs