Action game for a menu

Hello everyone, I have a problem to set up action for a JavaFX menu root.

I tried the following snippet is unsuccessful:
@FXML
private MenuBar mainNavBar = new MenuBar();
               
final Menu menu = new Menu("My Menu");
menu.setOnAction(new EventHandler<ActionEvent>() {
                    
     @Override
     public void handle(ActionEvent event) {
        // Doesn't go into this method on click of the menu
        System.out.println("Inside On Action!!!");
     }
});
menu.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {

    @Override
    public void handle(MouseEvent e) {
        // Doesn't go into this method on click of the menu
        System.out.println("Inside Event Handler");
    }
});
mainNavBar.getMenus().add(menu);
However, the following code works if I add a menuItem:
@FXML
private MenuBar mainNavBar = new MenuBar();
               
final Menu menu = new Menu("My Menu");
final MenuItem menuItem = new MenuItem("My Item");
menuItem.setOnAction(new EventHandler<ActionEvent>() {
                    
     @Override
     public void handle(ActionEvent event) {
        // GOES into this method on click of the menu item 'My Item'
        System.out.println("Inside On Action!!!");
     }
});
menu.getItems().add(menuItem);
mainNavBar.getMenus().add(menu);
So, is there a way to make this work without adding the item menu in the menu that I have some menus such as help, on, etc., which does not have a menu item.

Any help to fix this would be appreciated. BTW I use "JavaFX SDK 2.2" and "JavaFX Runtime 2.2"

Thank you.

Well, it looks like there is no way to capture a click on a Menu event, however, because whenever you click Top doesn't show her children, I believe that the code below may help you:

menuAdm.showingProperty().addListener(new ChangeListener() {
     @Override
     public void changed(ObservableValue observableValue, Boolean oldValue, Boolean newValue)
     {
          if(newValue.booleanValue())
               System.out.println("Showing|Clicked");
          else
               System.out.println("Not showing|Clicked again");
     }

});

Tags: Java

Similar Questions

  • Where is a place to get games for Vista and XP (also Win7) free offline?

    Where is a place to get games for Vista and XP (also Win7) free offline?

    Looked on Clubic, there are too many Add-ons (not the originals) and demos or deadlines.

    Are looking for is not online, you can mention them. No bootleg or emulators and other.

    Freeware role-playing, action, puzzle, classics/basics (ladies, old style, etc.), old style (like the games arcade, nintendo, SNES, Sega, Playstation 1, etc.), shooters, etc. All styles are ok and I wanted.

    I understand that some freeware games could be like older versions of power and magic, Diablo or Doom/Quake, etc.. I don't mind. Just try not to spend money on the latest and best at the moment. There is more to do in free time. For example: I would be fine if there are something like older versions of two EX or Skyrim or Fallout, Crysis, Age Of Empires, Metroid (SNES), etc. But I understand that I can only ask for so much.

    I found mmohut on youtube and it is recommended a lot, they tend to seem to all be online, however. My internet is down now, and I don't want don't no need to connect for stuff too. I think something like steam is out of the picture at this time.

    Hi Brian,.

    I suggest you to check the link mentioned below for the games.

    http://marketplace.Xbox.com/en-us/PC

    You can also use your favorite download games research search engine you like.

    Warning: Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

  • Download titans mahjong game for windows 7

    where to download game for windows 7 Home Basic mahjong titans

    Mahjong Titans is not included in Home Basic edition:
    http://Windows.Microsoft.com/en-us/Windows7/Mahjong-Titans-how-to-play

    You can upgrade to Home Premium for Mahjong Titans:

    Express Upgrade purchase

    Type of upgrade Express in the box files and research programs in the start menu and click the Windows Anytime Upgrade.  From there, you can buy an Express to Windows 7 Home Premium/Professional/ultimate upgrade. Then you can enter your Express Upgrade product key and perform a simple upgrade from Windows 7 Home Premium/Professional/ultimate. Online Anytime Upgrade is not available in all countries. All programs and files will remain on the computer, there is no drive necessary and it takes about 10 minutes.

    http://Windows.Microsoft.com/en-us/Windows7/products/Windows-Anytime-Upgrade

  • Launch of Games For Windows Live doesn t

    Hi I m Aris and the use of windows 7, my problem is Games For Windows Live the launch of doesn t at all I think I deleted after using ccleaner but I reinstalled batman and that it was necessary to remind that I downloaded and installed it again, it shows only microsoft marketplace and asks me to sign in etc etc. I can t find anywhere Games For Windows Live I installed the game and the marketplace of microsoft again and again looked for much but nothing I used it for a game and the only batman arkham city so I put t know much about the program, in my opinion, he has appeared in the start menu programs it s not here any help please the game works well, but I can't save my progress I've updated everything windows update manager application.

    In C:\Program Files (x 86) \Microsoft Games for Windows - LIVE\Client I find the GFWLClient icon also but when I click on it I'm waiting a few seconds later but still it turns of the market. ijist want to creat a profile offline nothing else think me
    Thank you for your time

    Hello

    The question you posted would be better suited in the forums of Windows games.
    http://www.Microsoft.com/games/en-us/games/pages/BatmanArkhamAsylum.aspx
    http://support.Xbox.com/en-us/Games/PC-games/game-support

  • First Flash Player in FireFox after start total Casuses freeze except excessive action HD for 5 seconds

    Especially anytime I boot vista and use firefox to load the first page of interest of any Flash Player on this page, the Computer freezes.

    My mouse to tail (on the screen) will have multiple pointers, showing that the action of the mouse on the screen's show and then suddenly stops leaving the mouse pointers of 4-5 spread on the screen.

    When I say freeze, I want to say keyboard does not work, no option to see taskmanager, possible extra mouse no movement, no keys work.

    Then, it does nothing except totals action HD for several seconds (5) and then after that, everything is ok.

    I took the time that this has happened (looking clock screen) and returned with a search for the Explorer for the date and time to find all the files that had we created or modified during this time - nothing has changed - so the other question is how is it, nothing has changed when my HD was going ballistic (solid green light)?

    Since then I uninstalled FP in FF and removed my computer adobe.

    Thank you for your interest

    Upgrade to Firefox (26)

  • HP Pavilion HPE h8 - 1260t CTO: stuck at the screen with the words "Press ESC for Boot Menu" on the bottom

    I unplugged the graphics card to clean dust. After that I connected everything again, he stuck to the blue screen with the words "Press ESC for Boot Menu" on the bottom. If I press ESC at the beginning, it will go to a black screen and it will show the basic information of the computer (information about the processor and memory). It also show this black screen, "Press ESC for Boot Menu" on the bottom and it will show "Start menu" in the lower right corner. If I press F8 at the beginning, it's going to be the same black screen, but it does not "Start menu" show in the lower right. If I press F10 at the beginning, it will go to the same black screen, and it will show "setup" in the lower right. Can someone help me solve this problem? And thank you very much!

    So I suggest to look at the following and try to 'Clear the CMOS settings' as described at the bottom of the page: HP and Compaq Desktop PCs - specifications of the motherboard, IPISB-CH2 (Chicago).  Then see if there is no change at all.  If there is no improvement, then use the following http://www.hp.com/contacthp, fill in the form, create a folder for your question and then use the information to contact HP.

  • Game for the Satellite L300-1BW.

    Hey!

    Has never really been a PC Gamer if im this announcement at the request of a former veteran to help me. I've already lost nearly £ 30 tent of the game that I thought would go on my laptop, but unfortunately none did.

    Can anyone suggest me some good FPS games that would go well on my laptop.

    I would be grateful thanks anyhelp.

    Hello

    That s very simply.
    Every game needs certain hardware and software requirements.
    Just check the requirements that are associated with a game that is interesting for you and compare it with the specifications of laptop computers.

    I can't recommend games for laptop because I've got and use the PS3 for games ;)

    See you soon

  • Satego X 200 - 21u + Win7: freeze all playing a game for about 20 seconds

    Hello

    installed win7 a few weeks ago and I need help.

    as long as I have used default displays the drivers of toshiba (~ 1 year) windows7 tends to freeze while playing a game for about 20 seconds, and everything goes normal again.

    After searching the internal pool, I discovered that most recent nvidia driver could solve this problem, so I downloaded the latest drivers for your laptop from there. now windows freezes over, but rather a huge amount of pixels displayed for fractions of seconds. could someone help me? is it possible that toshiba will bring display drivers compatible win7?

    What are the changes accurate toshiba brings to their drivers? I cannot repeat this manual?

    * edit *.

    SRY for the bad language :).

    using the version of 32-bit win7

    Hi mate,

    The point is that you should only use the Toshiba display drivers directly because are pre-tested on the on the laptop. Other drivers don't have overheating protection, which means that you can display errors and damage to the graphics card. So I advise to use Toshiba display drivers.

    I don t know the difference between display drivers, you should ask this Toshiba directly and not here in the forum of the user.

    Maybe there is another solution for your problem like cleaning your laptop with a jet of compressed air. This could blow out the dust from the cooling fans.

  • I used "iTunes game" for 1

    I've been using "iTunes game" for 1 & 1/2 years and not "Apple music" (released on 30/06/15). Everything worked as expected before the "Apple"music. I could access all my downloads on my PC, the iPod & iPhone iCloud 5 (no automatic download).

    I could only access "iCloud bought" songs on my iPhone when 'Apple Music' was communicated. They have been downloaded automatically witch took the precious memory.

    All the songs of "matched iCloud" (not the purchase via iTunes) will not appear in the 'My music' library, but they are now in 'All Apple music'. If I select a song that I downloaded via 'Match iTunes' default to the screen saying 'start 3 month free trial for the Apple's music '.

    All other "iCloud mail' (not matched or purchased) are not accessible more in the library 'my music '. According to me, it's very unfair and against the statement that "for $25 / year, Apple will allow you to broadcast up to 25 000 songs from your library iTunes music to your devices with your Apple ID.»

    My PC and iPod still work as expected only because, and an update of ios has not forced to basically default purchase "music from Apple.

    I'd appreciate comments.

    Larry

    I started with the same problem on my iPhone a few days ago 5.  Suddenly iTunes radio doesn't work and my playlists are gone also. And I was under the impression that with Match Apple iTunes Radio is free.

    Hope someone has an idea.

    Helga

  • Laptop does not, shows "press the ESC key for startup menu?

    Hello

    I have a hp laptop Pavilion g6 (product QE05UA #ABA, model: g6-1c35dx)
    . For a while his summer of problems, it was slow, showing the virus, and now it won't start.

    I left it on the mode 'sleep' last night, once I opened it today, it has been disabled. I thought that he lost battery which usually doesn't happen, but I turned it on and it shows a flashing screen that comes on and then turns black, again and again. the flashing screen shows "press ESC key for startup menu.

    In addition, the caps lock key will blink once when that lights up the screen.
    When I press "esc" it says this:

    The F1 system information
    The F2 System Diagnostics
    F9 boot device options
    Bios F10 Setup
    F11 system recovery
    Enter - continue starting

    I tried all of them, including some tests in "BIOS".

    I don't know much about computers, and it is one that I need so help is greatly appreciated.

    Hello @Mike1994r ,

    Thank you for your reply,

    I see that you were able to run the tests and make a recovery but the problem persists, I suspect a hardware problem.  As you were unable to locate the problem of testing, I suggest contacting HP support for assistance.

    Please contact our technical support at 800-474-6836. If you do not live in the United States / Canada region, please click on the link below to get a number of assistance for your region.

    World wide phone holder

    Good luck!

  • Can't sign in to games for windows marketplace using windows live id error: 80048439

    The problem:

    I bought a game a few days ago, but cannot sign in to games for windows marketplace. I try to connect using the GOOD live ID and the password that I used when buying this game on the website (it works when signing on my live account on internet and on this forum). A few seconds later, he says:

    "Unable to connect. ID Windows Live ID or the password entered is not valid. Enter your information and you reconnect. "error: 80048439 cannot authenticate.

    I tried several fixes that are found on the pages of support for games for windows live.

    I have reset my password

    I deleted all my cookies, cache files and internet (several times)

    When I try to connect to live in the game (using a steam game) I can't connect either.

    I looked in the port forwarding, but there is no explanation on how to do it on my router (actiontec q1000). I don't know if the port is the problem or what. It is not a new modem, and it worked a few months ago.

    I used gfw live years and had no problems until now and I swear that I use the password and login name.

    Any info I can get to solve this problem is appreciated.

    Hi theblur05,

    Method 1: You can see the steps mentioned in the article below, which deals with a similar question

    Games for Windows LIVE: you can not connect to LIVE and you receive an error message

    http://support.Microsoft.com/kb/938705

    If the problem persists, please post your request on the Forum Windows Live for more expert help

    Windows Live Forum -http://windowslivehelp.com/

    You can contact the games for Windows, Support for more
    http://www.gamesforwindows.com/en-us/support/

    Thank you, and in what concerns:

    Ajay K

    Microsoft Answers Support Engineer
    ---------------------------------------------------------------------------------------------------------
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to get back my games for window 7 ultimate?

    I deleted my games for windows 7 by mistake, thinking it was another folder of games. Is there a way I can download these games on my PC?

    Hi puertouk,

    1. for re - confirm the steps you followed to the turn or turn off the feature of Windows for games

    i. Click Start, in the search box type in turn windows features turn on or off

    II. uncheck the option of game, and then restart the computer.

    III. make game characteristic back follow the same procedure and check the option game and make sure that you restart the computer again.

    2. check if the games listed here: C:/Program files/Microsoft game. If the games are listed, you can restore by right-clicking on the name and select PIN to the taskbar.

    In this case, you will find the games in the folder "C:/Program files/Microsoft Game", you can copy the all the games one by one .exe file and paste it into the folder "Games Explorer.

    NOTE: Open Explorer games typing Games Explorer to start the search.

    Thank you, and in what concerns:

    Samhrutha G S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Games for Windows Live Setup error: "an error occurred during the installation XLiveRedist.msi.

    Original title: Games for Windows Live installation problems.

    I am trying to install Games for Windows Live, but there is a problem. The installation program downloads very well, but when I try to install the program, I get an error stating that: "an error has occurred during installation XLiveRedist.msi. I don't know what it is, or what I can do about it. Anyone know of any solution?    Thank you

    Hi Blackpudding427,

    Please post your concerns on the following forum link that is more related to your problem and can be solved better.

    http://forums.gamesforwindows.com/

    Kind regards

    Shinmila H - Microsoft Support

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Games for Pocket PC

    Hello

    I was wondering if anyone knew a secure site that has free games for a Pocket PC.

    Thank you.

    Hello

    I was wondering if anyone knew a secure site that has free games for a Pocket PC.

    Thank you.

    You can have all the shareware/freeware ones I had on my old Windows Pocket PC devices.  Here's a zip of them: http://1drv.ms/1vY2xOB

  • Games for windows live program does not. is not resident evil 5

    I am resident evil 5. the game won't start it comes up with an error xliveinitialize. also games for windows marketplace program will not work. I have download. install it. then try to run and he told me that the software files are missing and I want to install them. so I click Yes and it will make me re-download anywhere. and that never works. so now, ive got a game, I can't play and a program to make the game play that will also work. What can I do to fix this

    Hello

    (1) what version of windows are you using?

    (2) at what point of the installation you get the error message?

    See the link below.

    http://support.Microsoft.com/kb/977704

    If the link above is not enough, post in Games for Windows - Live forums.

    http://forums.Xbox.com/GFW/default.aspx

     

    I hope this helps.

Maybe you are looking for

  • Mail will not open on El Capitan 10.11. 4

    Post program started to freeze last week and now won't open (never closed anyway unless that force them to leave) Is there an easy fix for a beginner to make it work?

  • Temperature CPU M40X-259?

    Is it possible to control the temperature of the CPU of my M40X-259?I tried Everest and Notebook Hardware Control, both show only the HARD drive, temp.

  • How to set the start time of QuickTime movie in AppleScript?

    I've been tasked with finding a way to play videos to QuickTime in full screen at a specific time. It seems that I have to use AppleScript, which I've never used it before.  I wrote this, that does everything, but from the beginning of time says: Tel

  • Z3200: Z3200 after Propairing Ink System: Shut downs

    We have an opportunity Z3200 who asked two print heads. Replaced all, and all was well for a while.  Turning off the plotter, removed from power for 1 week.  After turning the power on again the Z3200 boot. Then the screen turns off, shuts down the p

  • Re: Satellite Pro L670 - can I turn off the sound when the battery is empty?

    Hello Is it possible to disable the bios beep when the battery is empty or the laptop's Hibernate? I have a Toshiba Satellite Pro L670. Even when the sound in Windows is turned off the laptop do a annoying sound. Thank you!