Browser frezes because of mouse event.

Have anyone tried to press the right mouse button and hold it within an applet and the drag it outside and release it? In my case it causes the browser to display options as if the mouse had been right clicked at som html. The browser craches and I am forced to close it.
I'm running Windown XP SP1 with SUN java plugin 1.4.1. IE 6.0 SP1
regards
Allan

Having an identical configuration to you, I reproduced the problem without any difficulty.
It's hard to know if this is a bug with the browser or the plugin itself. But it seems that you are not alone with this difficulty.
Since a number of users will probably have this configuration, about all you can do to avoid the problem is to discourage an action like this in your applet, or perhaps launch the main UI of the applet in a frame - that ought to fix it.

Similar Messages

  • When both plug-in objects and jQuery mouse events are present, Firefox re-starts the plug-in object (eg Flash movie) after a jQuery mouse event occurs. This doesn't happen in any other browser. How can I get around this?

    Please check http://www.syus.com for an example. There is a Flash movie underneath the main navigation. The main navigation has a jQuery mouse event, and when you mouse over a button in the main navigation, the Flash movie re-starts. I can confirm that this happens not only on Flash swf files, but on standard <object> YouTube embeds.

    Ok, I promise this is my last post without your help. I did some more troubleshooting and it only seems to happen when jQuery appends elements to the body that were previously invisible. In other words, I can simply change the css in jQuery from using element.css('display','inline'), but if I try to use something like slideDown or other jQuery tooltip functions that append and/or remove elements or style definitions it causes the "object restart" bug.
    It is impossible for any developer to eliminate this bug without changing the actual source of jQuery, which I can't do. My only other option is not to use sophisticated show/hide jQuery elements like drop-down menus and tooltips on the same page as an embedded object, but I don't want to do this since Safari, Chrome and even IE (dear God) users won't have a problem with this. I think this is a major major bug that should be fixed in Firefox 4 as more and more sites will be looking to use the latest jQuery plugins.

  • Mouse events don't work on a button from a panel ran in a DLL

    Hi.
    I have a DLL that loads a panel.
    Since it's a DLL I can't do the RunUserInterface() function, because the DLL would be stuck waiting for the panel events.
    I only do the LoadPanel().
    When I click with the mouse on one of the buttons, the pushing down event (simulating the button being pressed) doesn't happen and the callback doesn't run.
    But if I press the tab button until the focus reaches the button and press Enter, the callback of the button is executed.
    An even more interesting aspect is that this happens when I call the DLL on TestStand, but on an application of mine that calls the DLL just for debug everything works fine.
    How can I enable the mouse events?
    Thanks for your help.
    Daniel Coelho
    VISToolkit - http://www.vistoolkit.com - Your Real Virtual Instrument Solution
    Controlar - Electronica Industrial e Sistemas, Lda
    Solved!
    Go to Solution.

    Hello Daniel,
    I got surprised when I read your post, because I am experiencing something almost the same as you do.
    I have a DLL (generated by an .fp instrument driver I wrote) which performs continious TCP communication with the UUT.
    It starts 2 threads, each for reading from one of the 2 different IPs the UUT has.
    Another DLL tests this UUT (with the help of the communication DLL above) by exporting functions to be called by TestStand steps.
    If the second DLL wants to display a CVI panel in order to wait for the user response or displays a popup (MessagePopup, ConfirmPopup, etc), user cannot press the buttons.
    Actually, there is a point your program and mine differ. I call RunUserInterface and the button's callbacks call QuitUserInterface, so the execution continues after a button is pressed. The problem is buttons cannot be pressed. I also tried looping on GetUserEvent  but it did not solve the problem.
    There are 2 findings:
    1. I had a small exe to test my instrument driver DLL and the popups in it worked pretty well (this coincides with Daniel's findings).
    2. We workedaround the problem by shutting down the communication threads in the instrument driver DLL before the popup appears and restrating them afterwards. Although they are separate threads in another DLL, they were somehow blocking user events on another DLL running.
    S. Eren BALCI
    www.aselsan.com.tr

  • Mouse Events are slow

    Hello everyone,
    I'm currently working on an standard as3 (1024x768) app that
    is running inside a chromeless Air window to take advantage of the
    transparency.
    All my tests where done using windows XP professional and AIR
    1.0 (the same problem existed in beta3).
    The issue I'm having is related with Mouse Events. Somehow
    the events take a lot of time to reach the swf file when the user
    clicks inside the transparent window.
    It's natural that the app runs slower inside a transparent
    window (the framerate drops) but I wasn't expecting the clicks to
    suffer from such delay (it takes sometimes 2-5sec).
    The app is very CPU intensive and the transparencies make it
    worse. Something inside the AIR framework is not dispatching the
    events properly.
    I say this because I tried using the virtualMouse class from
    senocular together with a socket to simulate the mouse clicks and
    that did the trick.
    In conclusion:
    Something in the AIR framework for windows XP is messing up
    the dispatch of the Mouse events when the app is under heavy cpu
    usage inside a chromeless window. I click on the window and it
    takes 1-2sec to receive the click event.
    However when I dispatch the MouseEvent.CLICK myself using
    the virtual mouse class the application immediately receives the
    event.
    I know this is a strange bug and not many people will have
    this problem, but I would like to know from someone with knowledge
    of the runtime why this could be happening.
    Thank you
    Tiago Bilou

    Hello everyone,
    I'm currently working on an standard as3 (1024x768) app that
    is running inside a chromeless Air window to take advantage of the
    transparency.
    All my tests where done using windows XP professional and AIR
    1.0 (the same problem existed in beta3).
    The issue I'm having is related with Mouse Events. Somehow
    the events take a lot of time to reach the swf file when the user
    clicks inside the transparent window.
    It's natural that the app runs slower inside a transparent
    window (the framerate drops) but I wasn't expecting the clicks to
    suffer from such delay (it takes sometimes 2-5sec).
    The app is very CPU intensive and the transparencies make it
    worse. Something inside the AIR framework is not dispatching the
    events properly.
    I say this because I tried using the virtualMouse class from
    senocular together with a socket to simulate the mouse clicks and
    that did the trick.
    In conclusion:
    Something in the AIR framework for windows XP is messing up
    the dispatch of the Mouse events when the app is under heavy cpu
    usage inside a chromeless window. I click on the window and it
    takes 1-2sec to receive the click event.
    However when I dispatch the MouseEvent.CLICK myself using
    the virtual mouse class the application immediately receives the
    event.
    I know this is a strange bug and not many people will have
    this problem, but I would like to know from someone with knowledge
    of the runtime why this could be happening.
    Thank you
    Tiago Bilou

  • Mouse events during Thread.sleep

    hi.
    I have an applet .
    I have a alghoritm simulator.
    Everytime I find a solution I call the method Thread.sleep .
    I want to pause the application and I create a JToggleButton Pause .
    When I press the Pause during sleep mouse event are managed at the end of alghoritm.
    How can I manage mouse events during sleep?

    All UI events (such as mouse events) occur on the event dispatch thread (EDT).
    That means if you sleep on the EDT, you lock up the UI. For this reason, you shouldn't be sleeping on the EDT.
    I'm not sure what your sleep is trying to do but you need to manage your threads a little more carefully. For instance, any time consuming process which is invoked as a result of a UI event needs to be fired on a new thread to prevent the UI freezing. The fun starts when you have to update the UI as a result of that process, because you should then hook back onto the EDT to avoid the risk of deadlock.
    Some utility classes are provided, such as SwingUtilities, and other example code is provided on Sun's site, such as SwingWorker - but if you do much UI work you'll probably end up with your own core set of threading tools and so on to make life easier.

  • Touch to Mouse events conversion

    Hi Everybody!
    Does anybody know how correctly fire mouse events to Oracle Maps in javascript?
    Default translation touch events in iPad Safari does not quite fit. It try zoom or pan browser window, not map. :(
    If catch touch events and disable default translation I can zoom and pan MVMapView object.
    But how fire "click","mousemove","mouseover" events on Map? I need dispatch event to ThemeBasedFOIs (InfoWindow Popup and other listeners)?

    Yes. The Oracle Maps tutorial contains examples (the tutorial can be found in your mapviewer deployment
    e.g. http://localhost:7001/mapviewer/fsmc/tutorial/index.html) and documentation in the API reference
    (e.g. http://localhost:7001/mapviewer/fsmc/apidoc/index.html). Look at MVEvent and the attachEventListener function of MVMapView, MVThemeBasedFOI, and MVFOI classes for example.

  • Need More Mouse Events

    [http://forums.sun.com/thread.jspa?messageID=10811388|http://forums.sun.com/thread.jspa?messageID=10811388]
    During search over net I found the above thread and it seems to be describing the same problem which I am also facing. For my application also I need to capture all the mouse events while dragging. I tried the soluiotn mentioned at this thread to solve this problem by overrinding the below method in several ways:
    protected AWTEvent coalesceEvents(AWTEvent existingEvent,AWTEvent newEvent);
    Even after several attempts, I could not succeed. Can you please suggest how to do that. I was not able to reply to above thread so creating this new thread.
    Thanks

    I wanted to see if a timer based approach does indeed produce a smoother curve than just simply listening for mouse drag events. What I came up with below was the resulting test code. Lo and behold, using a timer does indeed produce a smoother curve. But it wasn't because it was capturing more mouse positions, it was because it was capturing less. Ain't that a kicker? Another interesting thing is that according to the source code, coalesceEvents is a no-op. The documentation, however, would have you believe that it coalesces mouse events as I thought it did.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.GeneralPath;
    import javax.swing.SwingUtilities;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.Timer;
    import javax.swing.BorderFactory;
    public class Test {
        private static class TimerBasedPanel extends JPanel implements MouseListener {
            private GeneralPath line;
            private Timer mousePosQuerier;
            private Component mouseEvtSource;
            private int pointCount;
            public TimerBasedPanel(Component mouseEventSource) {
                mousePosQuerier = new Timer(15, new ActionListener() {
                    Point lastMousePoint = new Point(-1, -1);
                    public void actionPerformed(ActionEvent e) {
                        Point p = MouseInfo.getPointerInfo().getLocation();
                        if (p.x != lastMousePoint.x || p.y != lastMousePoint.y) {
                            lastMousePoint.setLocation(p);
                            SwingUtilities.convertPointFromScreen(p, mouseEvtSource);
                            line.lineTo(p.x, p.y);
                            pointCount++;
                            repaint();
                mouseEvtSource = mouseEventSource;
            public void paintComponent(Graphics g) {
                super.paintComponent(g);
                if(line != null) {
                    ((Graphics2D) g).draw(line);
            public void mousePressed(MouseEvent e) {
                line = new GeneralPath();
                line.moveTo(e.getX(), e.getY());
                pointCount = 1;
                mousePosQuerier.start();
            public void mouseReleased(MouseEvent e) {
                mousePosQuerier.stop();
                repaint();
                System.out.println("Timer Based, Points Captured: " + pointCount);
            public void mouseEntered(MouseEvent e){}
            public void mouseExited(MouseEvent e){}
            public void mouseClicked(MouseEvent e){}
        private static class DragEventsPanel extends JPanel
                implements MouseListener, MouseMotionListener{
            private GeneralPath line;
            private int pointCount;
            public void paintComponent(Graphics g) {
                super.paintComponent(g);
                if(line != null) {
                    ((Graphics2D) g).draw(line);
            public void mousePressed(MouseEvent e) {
                line = new GeneralPath();
                line.moveTo(e.getX(), e.getY());
                pointCount = 1;
            public void mouseDragged(MouseEvent e) {
                pointCount++;
                line.lineTo(e.getX(),e.getY());
                repaint();
            public void mouseReleased(MouseEvent e){
                System.out.println("DragEvent Based, Points Captured: " + pointCount);
            public void mouseEntered(MouseEvent e){}
            public void mouseExited(MouseEvent e){}
            public void mouseClicked(MouseEvent e){}
            public void mouseMoved(MouseEvent e) {}
        public static void main(String args[]) {
            JFrame frame = new JFrame();
            JPanel drawPanel = new JPanel() {
                @Override
                protected AWTEvent coalesceEvents(AWTEvent existingEvent,
                                                  AWTEvent newEvent) {
                    if(newEvent.getID() == MouseEvent.MOUSE_DRAGGED) {
                        return null;
                    }else {
                        return super.coalesceEvents(existingEvent, newEvent);
            TimerBasedPanel timerPanel = new TimerBasedPanel(drawPanel);
            DragEventsPanel dragPanel = new DragEventsPanel();
            drawPanel.setBorder(BorderFactory.createTitledBorder("Draw here"));
            timerPanel.setBorder(BorderFactory.createTitledBorder("Uses a timer"));
            dragPanel.setBorder(BorderFactory.createTitledBorder("Listens for drag events."));
            drawPanel.addMouseListener(timerPanel);
            drawPanel.addMouseListener(dragPanel);
            drawPanel.addMouseMotionListener(dragPanel);
            frame.setLayout(new java.awt.GridLayout(0,3));
            frame.add(drawPanel);
            frame.add(timerPanel);
            frame.add(dragPanel);
            frame.setSize(600,200);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
    }Edited by: Maxideon on Sep 16, 2009 9:56 PM
    Minor error, but now fixed.

  • How to make the row header of the JTable respond to mouse events?

    Is there an easy way to enable the row header of a JTable so it listens to mouse events? I have put a button in the first cell of the row header but I can't click in it.
    I'm asking for an easy way because I've seen some fairly complicated examples on the web that seem close to what I want but I was hoping something simple like getRowHeader().setEnabled(true) would do the trick for my case...

    What's your row header, another JTable or something else? Check out camickr's [url http://tips4java.wordpress.com/2009/07/12/table-button-column/]Table Button Column.
    db
    edit Or to get better help sooner, post a [url http://mindprod.com/jgloss/sscce.html]SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.
    Edited by: Darryl Burke

  • Mouse event problem (NEW problem)

    Sorry guys...
    The last problem was solved, yes... but another one has shown
    up!
    Remember the code:
    txt82.visible = false;
    botao82.addEventListener(MouseEvent.MOUSE_OVER, botao82over);
    botao82.addEventListener(MouseEvent.MOUSE_OUT, botao82out);
    botao82.addEventListener(MouseEvent.CLICK, botao82click);
    function botao82over(event: MouseEvent)
    txt82.visible = true;
    function botao82out(event: MouseEvent)
    txt82.visible = false;
    function botao82click(event: MouseEvent)
    gotoAndPlay("video82");
    where i wanted a texto to show or hide depending on the mouse
    event?
    Ok...
    Now, when i CLICK, i'll go over to "video82" allright, but
    i'll ALSO get an error!
    "Cannot access a property or method of a null object
    reference" - on botao82out
    which means that: when i click and move up to "video82", the
    mouseout is also called to make the text dissapear but the function
    is no more available because we've moved up to another time.
    Any possibilities?
    Erik.

    Hi Haran,
    bota82 IS the movieclip, which has to be like that because of
    the naming of it's instance, used to get called in the code.
    But anyway, guys, i found the solution! YEP! Increases
    tremendously the code, but... well... it works!
    i had the button layer extended all over the time.
    The problem with this is that when i clicked and went to the
    frame video82, for example, all the buttons still showed as
    clickable.
    How did i solve that?
    More magic! Disappearing magic!
    at the beginning of the code i certify the buttons to be
    visible:
    botao82.visible = true;
    and so on with all of them...
    then, right before the click function, i turned them all OFF
    ! :D
    function botao82click(event: MouseEvent)
    botao82.visible = false;
    botao83.visible = false;
    botao84.visible = false;
    botao85.visible = false;
    botao86.visible = false;
    botao87.visible = false;
    botao88.visible = false;
    botao89.visible = false;
    botao90.visible = false;
    gotoAndPlay("video82");
    Phew! It worked!
    Know what? I think clearer when i discuss the problem with my
    fellows here in the forum! Thanks everyone.
    Hope this helps others in the future!
    Erik.

  • [svn:fx-3.x] 9228: Fix off-screen mouse events in AIR.

    Revision: 9228
    Author:   [email protected]
    Date:     2009-08-11 11:59:47 -0700 (Tue, 11 Aug 2009)
    Log Message:
    Fix off-screen mouse events in AIR.
    QE Notes: None
    Doc Notes: None
    Bugs: SDK-21453
    Reviewer: darrell
    tests: checkintests
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-21453
    Modified Paths:
        flex/sdk/branches/3.x/frameworks/projects/airframework/src/mx/managers/WindowedSystemMana ger.as

    now I have this and it still doesn't work.
    Section "ServerLayout"
    Identifier "Simple Layout"
    Screen "Screen 1" 0 0
    InputDevice "Mouse1" "CorePointer"
    InputDevice "Touchpad" "SendCoreEvents"
    InputDevice "Keyboard1" "CoreKeyboard"
    Option "OffTime" "1"
    EndSection
    Section "ServerFlags"
    Option "AutoAddDevices" "False"
    Option "DontZap" "false"
    EndSection

  • After setting stage.transform.matrix3d, mouse event localX/Y stageX/Y do not work

    Hello
    Because i need to do 3d transformation on the whole stage, i set the stage transfromation.matrix3d.
    I made one test application and find that mouse event doesn't work properly.
    In my application, i simply add a sprite containing red circle and test the functions.
    Besides, i scale the stage along x-axis half using stage.transform.matrix3D
    The problem is that when i click on my red circle, the e.localX/Y and e.stageX/Y are all zeros.
    But if i click on places rather than my red circle be, the e.localX/Y and e.stageX/Y work fine.
    Here is my code.
    public function init():void{
                                  var m:Matrix3D= new Matrix3D();
                                  m.copyRowFrom(0,new Vector3D(0.5,0,0,0));
                                  m.copyRowFrom(1,new Vector3D(0,1,0,0));
                                  m.copyRowFrom(2,new Vector3D(0,0,1,0));
                                  m.copyRowFrom(3,new Vector3D(0,0,0,1));
                                  stage.transform.matrix3D = m;
                                  s.graphics.beginFill(0xff0000);
                                  s.graphics.drawCircle(0,0,50);
                                  s.graphics.endFill();
                                  addChild(s);
                                  s.x = (stage.stageWidth)/2;
                                  s.y = (stage.stageHeight)/2;
                                  s.z = 0;
                                  stage.addEventListener(MouseEvent.CLICK, onStageClick);
    private function onStageClick(e:MouseEvent):void{      
                                  trace("global" + e.stageX + " " + e.stageY);
                                  trace("local" + e.localX + " " + e.localY);

    1. In the code, I think it should change the value of the "player" so that it reflects the right turn. E.g. after the user press the mouse, the player should be changed to "computer" and after the computer goes, the player should be changed to "you". Otherwise, the player stays the same value and the program will only print out one symbol, which in this case is "O".
    2. To make the previous moves stay, the code has to get some way to remember the moves. So before the repaint, the program will record the context for the next paint method.
    Regards,

  • How to distinguish is cell get key event or mouse event in table?

    Hi!
    I have a JTable.
    1.Select cell and double click. As result caret is show
    2.Select cell and start type. As result caret is show
    How distinguish is caret is show, because cell get mouse event or key event?
    Thank you.

    Hm ...
    the problem with the key events is, that they are partically taking place in an editor component - but the double click of the mouse clicked on a cell, which is not currently edited, can be get by a MouseListener added to the JTable.
    My idea to that is as follows - hold the double_clicked state in a boolean variable hold by your JTable subclass - it is set by a MouseListener added to the JTable - and reset by the overwritten prepareEditor(...) method. This method should do the following:
    // say, double_clicked is a boolean field in your JTable subclass
    public Component prepareEditor(TableCellEditor editor,int row,int column) {
    Component c = super.prepareEditor(editor,row,column);
    if ((!double_clicked)&&(c instanceof JTextField)) { ((JTextField) c).setText(""); }
    double_clicked = false;
    return c;
    }now you have only to implement an add a MouseListener to your JTable subclass which detects this double click and sets the double_clicked field accordingly.
    This is an idea on the fly - hope it is helpful for you.
    greetings Marsian

  • Unhandled mouse events

    I had a problem and solved it, but I don't like the solution and still don't get the problem. So, I hope somebody can explain:
    I am using TestStand in combination with a LabWindows/CVI Operator Interface. At a certain point I have to open a second LabWindows/CVI UI application (reused for some specific operator interaction). An operator eventually closes the second UI via a 'Close' button. However, the UI does not respond to mouse events on the button. The UI does respond to the shortcut keys (Esc or Alt-C).
    I discovered that it is not the first UI (the Operator Interface) that is 'stealing' the events. It appears that TestStand does not allow the UI to process the events. As soon as a Message Popup step is being executed the events are handled. So, we made TestStand periodically verify whether the Close button was pressed in a call to the second UI. In the UI we first call ProcessSystemEvents. This worked pretty well. But, then I decided to neatly place the periodic poll in a separate sequence running in a separate thread. Again I ran into the same problem. So, the TestStand execution really has to get interrupted and I am forced to pollute my sequence files with the periodic polls. Boeh hoe :-(
    Greetz,
    David Meijers

    Bas,
    I will try to extract a usefull stand-alone example out of our complete system. It might take a while though, because I have a workaround (so, I will try finding the problem in spare time for the better of mankind ).
    Greetz, David

  • Absorbing mouse events

    In my application, if someone clicks on a button about 10 times before it visually updates itself, the first click, initializes a change in the GUI, and another button appears in the same place. The second click, is then processed after the first press has completed, and calls the action on the next button, and so on and so on. I want to be able to stop it from doing this. Since it is all on the same thread, I can't say, absorb all button clicks until this event is complete, because they are all still sitting in the event queue. I don't exactly have a whole lot of useful methods to use in the EventQueue class to just say, hey remove all mouse events at this point. Any Ideas?
    Maybe this will describe the situation better.
    Mouse Click #1 added to queue
    Mouse Click #1 removed from queue, processing event.
    Mouse Click #2 added to Queue
    Mouse Click #3 added to Queue
    Mouse Click #4 added to Queue
    Mouse Click #5 added to Queue
    Mouse Click #1 completed event, new screen is visible.
    Mouse Click #2 removed from queue, processing event on button on new screen.
    ...and so on
    I want to be able to ignore all mouse events prior to Mouse Click #1's completion.

    Suppose that when you start processing a mouse event
    you set a busy flag somewhere, and when you finish
    processing it you reset the flag. Your mouse listener
    checks the busy flag and drops the click event if it's
    set.Problem with this is when I'm at the end of the process, then I enabled the flag, THEN the next event gets processed, and the flag is enabled.
    As far as disabling and enabling the buttons, I can try it, but I'm betting it is falling into the same scenario as the flag. My big issue is people double clicking, and the clicks are all registering as 1 click, so 2 seperate events get fired, first one changes the screen, second one clicks on the button on the next screen.
    I may have some across a solution that I will test later. It involves storing the completion time of the operation, then when starting the next event, check the event time and see if it is after the completion time, otherwise return.

  • MOUSE Events on FX 2.0 not working correctly

    Hi,
    I am trying to capture mouse right click in my Java FX application to show the ContextMenu but couldn't do so.
    There are methods available in the API i.e. isSecondaryButtonDown() and isPrimaryButtonDown on MouseEvents to capture mouse clicks but not working.
    Both of the above mention methods return false irrespective of right or left click.
    I will be glad to see resolution for it.
    Thanks in Advance.
    Ashish

    I have no idea what the context of the code you are writing is, but capturing of MouseEvents works fine for me.
    Perhaps you are trying to test mouseEvent.isSecondaryButtonDown() in a MOUSE_CLICKED event handler which will correctly return false after a right mouse click because the click event can't be generated until the button is released (i.e. no longer down).
    import javafx.application.Application;
    import javafx.event.*;
    import javafx.scene.Scene;
    import javafx.scene.control.*;
    import javafx.scene.input.*;
    import javafx.scene.layout.StackPane;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Rectangle;
    import javafx.stage.Stage;
    public class MouseEventTest extends Application {
      public static void main(String[] args) throws Exception { launch(args); }
      public void start(final Stage stage) throws Exception {
        // provide some instructions.
        final Label instructions = new Label("Right click anywhere to choose a fruit");
        instructions.setStyle("-fx-font-size: 20;");
        instructions.setMouseTransparent(true);
        // ready a context menu.
        final ContextMenu fruitChoices = new ContextMenu();
        fruitChoices.getItems().addAll(new MenuItem("Apples"), new MenuItem("Oranges"), new MenuItem("Pears"));
        for (final MenuItem menuItem : fruitChoices.getItems()) {
          menuItem.setOnAction(new EventHandler<ActionEvent>() {
            @Override public void handle(ActionEvent actionEvent) {
              instructions.setText("Enjoy your " + menuItem.getText());
              System.out.println("You like " + menuItem.getText());
        // display the context menu whenever a user clicks inside a node.
        final Rectangle node = new Rectangle(400, 300, Color.LIGHTBLUE);
        node.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
          @Override public void handle(MouseEvent mouseEvent) {
            System.out.println(mouseEvent);
            System.out.println("Secondary button down: " + mouseEvent.isSecondaryButtonDown());
            if (MouseButton.SECONDARY.equals(mouseEvent.getButton())) {
              System.out.println("Choosing fruit");
              fruitChoices.show(instructions, mouseEvent.getScreenX(), mouseEvent.getScreenY());
        // show the scene.
        final StackPane layout = new StackPane();
        layout.getChildren().addAll(node, instructions);
        Scene scene = new Scene(layout); 
        stage.setScene(scene);
        stage.show();
    }

Maybe you are looking for

  • How do I move GarageBand files from iPad 2 to New iPad?

    My laptop is a PC, not a Mac. At the Apple store I was told it was no problem. I merely back up my iPad 2 and then restore my New iPad (3) from that backup. So far it isn't working and I've tried several times. Weirdly, when I first set up my New iPa

  • Session attribute cached

    Hi there, I have a problem with logging my user out. I have searched through this forum and tried all the methods listed including: 1) At the logout page I did this: session.invalidate(); session = request.getSession(true); 2) I did this on all my JS

  • Vendor Portal

    Hi all, Can anybody tell me what r the application required to vendor portal?

  • Can't retrieve back a podcasting

    I have a question. I have been using itunes for downloading podcasts for quite some time now, and I have noticed the following thing happening: Whenever a podcasting starts to get downloaded, and I interrupt it for whatever reason, either it gets rem

  • How to use fn:tokenize with fn:contains

    Greentings! After searching in google, I came here to see if someone can help me using fn:contains and fn:tokenize at the same time. I am developing a data service that will receive a departament acronym and the name or part of the name of an employe