Menu Item to exit a JavaFX application

Hi. I'm very new to JavaFX so please forgive what may be an obvious question.
Can anyone provide an example of the code to create a menu entry eg File->Exit that will exit a JavaFX app?
I can create the menus but I don't know how to perform the actual exit.
Do I use the setOnAction method? What code performs the actual closing of the app?
Thankyou.
Tony

Hi. Here is an example:
import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
import javafx.scene.control.*;
public class MenuIt extends Application {
    public static void main(String[] args) {
        Application.launch(args);
    @Override
    public void start(Stage primaryStage) {
        MenuItem menuItem = new MenuItem("Exit");
        final Menu menu = new Menu("File");
        menu.getItems().add(menuItem);
        MenuBar menuBar = new MenuBar();
        menuBar.getMenus().add(menu);
        menuItem.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                Platform.exit();
        primaryStage.setTitle("Menu sample");
        Group root = new Group();
        Scene scene = new Scene(root, 300, 250);
        root.getChildren().add(menuBar);
        primaryStage.setScene(scene);
        primaryStage.show();
}

Similar Messages

  • Menu items button in android tablet application not displayed

    I used to build my tablet air applications with flex sdk 4.5.
    I test it mainly on Galaxy Tab .
    When i upgraded to 4.6 sdk, I noticed that the system bar didn't displayed buttons anymore. it is completly empty.
    and  viewMenuItems didn't work anymore, too.
    is someone noticed  the same problem?
    Could it be a air runtime bug?
    I'd like to keep on working with sdk 4.6 for softkeyboard capabilities; please help me. Is there a solution?

    Hello, I am also having the same problem.
    Did you figure out any workaround.
    would you please share with me.
    thanks.

  • Scripting menu items

    I desperatly ned to find out how to use applescript for exporting pages document.
    One way could be through menu scripting.
    I am able to show the ruler of a pages document with the code at the end of this message.
    But how can I Export a pages document to word format using menu items.
    Thanks
    Jitse
    tell application "Pages"
    activate
    end tell
    tell application "System Events"
    tell process "Pages"
    activate
    set frontmost to true
    tell menu bar 1
    tell menu bar item "View"
    tell menu "View"
    click menu item "Show Rulers"
    (*click button "PDF" of radio group of sheet 1 of window 1 *)
    end tell
    end tell
    end tell
    end tell
    end tell

    If you don't mind using [GUI Scripting|http://www.macosxautomation.com/applescript/uiscripting/index.html], then the following script (which runs flawlessly on my computer) should do what you are asking for:
    --BEGINNING OF SCRIPT
    set theName to "Pages document.doc"
    tell application "Pages" to activate
    tell application "System Events" to tell process "Pages"
    click menu item "Export…" of menu 1 of menu bar item "File" of menu bar 1
    repeat until sheet 1 of window 1 exists
    end repeat
    click radio button "Word" of radio group 1 of sheet 1 of window 1
    click button "Next…" of sheet 1 of window 1
    keystroke "a" using command down -- Select All (⌘A)
    keystroke theName
    keystroke "d" using command down -- save to Desktop (⌘D)
    keystroke return
    end tell
    --END OF SCRIPT
    Hope it can help.
    (The above script was tested with Pages ’09 and Mac OS X 10.6.2 “Snow Leopard”.)
    Message was edited by: Pierre L.

  • Is it possible to send data from an external application to a plug-in that executes a menu item?

    I want to pass some parameters from an external appliaction  to my own plug-in. The plug-in creates a menu item for adding electronic signature. The menu item is executed from my external application using MenuItemExecute("mymenutem").

    Since you control the application AND the plugin - you can define ANY method of communication you want.  Shared files, shared memory, IPC, named pipes, etc.

  • How to Disable Menu item in Oracle Applications

    Hi,
    How can I disable a Menu (Actions->user defined menu) Item in Oracle applications by using forms personalization.
    Our requirement is to display a message on click of a standard menu using form personalization and it should retain the seeded functionality.
    Thanks
    Prasanna
    Edited by: user13029651 on Jul 30, 2010 6:47 PM

    As an Oracle Applications Developer, your best friends are going to be the following docuements:
    <ul><li>Oracle Applications Developer's Guide </li>
    <li>Oracle Applications User Interface Standards for Forms-Based Products</li>
    <li>Oracle Application Framework Personalization Guide</li></UL>
    These and all of the other related EBS documents can be found in the Oracle Applications (EBS) Documentation Home and don't forget the Oracle eTRM Technical Reference, but you will need an Oracle Support contract to access this site.
    When you can't find your answer in these document sources, you can always ask for help in the E-Business Suite group of forums.
    Craig...

  • Discoverer Plus/Viewer from menu item in Oracle Applications errors.

    Starting Discoverer Plus/Viewer from menu item in Oracle Applications R12 errors.
    Here is some general config information that is suspected to be the issue.
    1. Running Oracle Applications R12 over HTTPS.
    2. Running Discoverer Plus/Viewer over HTTP.
    3. Calling menu item that calls a function to start Plus/Viewer.
    Function Definition called by the menu item is listed blow.
    Properties Tab: Type=SSWA jsp function Context Dependence=Responsibility
    Form Tab: Parameters="mode=DISCO"
    Web HTML Tab: HTML Call=OracleOasis.jsp
    Fact: Starting Discoverer Plus using a URL works fine in the browser. The login page comes up and I can look in to Plus.
    The page that dose a redirection to start the Plus applet or Viewer web page fails with this error in IE 7.
    Internet Explorer cannot display the webpage
    Most likely causes:
    You are not connected to the Internet.
    The website is encountering problems.
    There might be a typing error in the address.
    Thank you for your time.

    Hi,
    Check that the ICX system profiles are set correctly for your Discoverer configuration. In particular the ICX: Discoverer Launcher and ICX: Discoverer Viewer Launcher system profiles.
    When IE displays an error is the URL displayed in the browser a correct Disco URL?
    Rod West

  • Air desktop application: how to make a menu item bold?

    Hi, I'm using Flash CS6 to develop an AIR desktop application for OSX. I've created my menu using NativeMenu and such, but I can't find a way to make the first menu item bold, like a true OSX app. So far the little I've found on this always referred to Flex, not Flash. Any hints?
    Thank you.

    Thank you, kglad.
    I think I forgot to mention I'm building an Application Menu. The NativeMenu contains NativeMenuItems and there is no format property or method that I can see. Also, the name the menu item displays is its label property, which you can set, but it's a string, and I believe the htmlText applies to textfields, right?

  • "Application access" menu item is grey: how to ena...

    Hi,
    Can any one Please help me know why the "Application access" is grey ?
    How to enable "Application access" menu item ?
     NOKIA 5610 Xpress music v 08.23 RM-359 variant 33.26
    Thanks,
    Sri

    Hi,
    Thank you for this link, this solution is working well with "SendKeys %ft" <=> "File > Page Setup..."
    I have also found a way to invoke menu item Tag but it just don't do anything with "APP_PRINTER_SETUP" <=> "Page Setup..." !!!
    http://forums.lavag.org/Two-small-tools-and-one-question-about-copy-and-paste-t5829.html&pid=36824&m...
    Best Regards,
    Emmanuel

  • Is it possible to add a single Entry Point menu item to a LabVIEW OI menu?

    Using the "TestStand - Insert Commands in Menu (Application Manager).vi" library VI, I can add all Configure menu items to a menu with the "CommandKind_ConfigurationEntryPoints_Set" option for the "Commands" input.  But the VI is missing an "Index" input to specify a single item from the collection.  (UnlikeThe "AplicationMgr.ConnectCommand()" function, which allows you to specify a single item with an index.)
    The issue is the same for Execution Entry Points and Tools as it is for Configuration Entry Point--I can create a menu containing the entire collection, but not a single item.  I tried to delve into the VI to change it to allow specification of individual commands using an index using the Commands.Insert() function instead of the Commands.InsertKind() function, but without success.
    As an aside, even when I add all Tools to a menu (using CommandKind_Tools_Set), TestStand exits with a warning that 12 "RunTimeMenuItem" objects were not released.  I'm wondering if I should be using the Engine.GetRunTimeToolMenuItems interface instead.  But if that's the case, I think I have to build the menu myself and can't use the TestStand library VIs to automatically run commands when their corresponding menu items are selected.  Maybe this is just a bug in the TestStand VIs?
    I am using TestStand 2010 SP1 with LabVIEW 2014.
    Any advice would be appreciated.  Thanks.
    -Jeff

    I am closing the TestStand Engine, VI Refnum, Quit Application event, and Event Callback, just like in the example.  I get the TestStand unreleased reference error only if I call that VI to include the Tools menu.  The fact that the unreleased objects are "RunTimeMenuItem" objects also implies to me that the problem is specific to the Tools menu items.  Since Tools menus seem to have their own API (which involves RunTimeMenuItems), it seems to me that the VI (or the TestStand Engine?) is doing something with RunTimeMenuItems that I can't see, and is somehow losing track of them (because that VI gives me no visibility to any RunTimeMenuItem objects).  Is it possible that one should explicitly use RunTimeMenuItem objects instead of the menu VI when dealing with Tools menus?  (Maybe the error is due to my using TestStand 2010 SP1 on Windows 8.1, for which TestStand 2010 SP1 is not officially supported?)

  • VBA Code for Excel Add-in Menu Items

    Howdy.
    Every month my team needs to execute the same process on a couple hundred documents. It's time consuming and inefficient to say the least, so I'm looking for a means by which to call a couple of the menu items on the Excel BPC Add-Ins menu via VBA. Specifically, Park'n'Go; Expand All; and Send and Refresh Schedules.
    Basically what happens is this:
    Open File
    Set Park'n'Go to Live
    Expand All
    Refresh and Send Schedules
    Set Park'n'Go to Offline
    Save
    Exit
    Loop
    I know how to loop through the files and directories, I just don't know the commands for the functions from the menu via code. The macro recorder can't help me, and I've even tried to mimic a user's actions by using mouse coordinates and clicks, but that doesn't work b/c it doesn't allow for the necessary load time from BPC.
    Any help would be extremely appreciated.

    Hey Jeff,
    here are some vba commands that may help you.
    Open a certain file: (you can assign "Path" to a button or range)
    Dim Path As String
    Path = Application.GetOpenFilename("All Files (.),.")
    Opening the Park 'n Go dialog box:
    Application.Run ("MNU_ETOOLS_PARKNGO")
    Expand All:
    Application.Run ("MNU_ETOOLS_EXPAND")
    Sending data and refreshing the workbook:
    Application.Run ("MNU_eSUBMIT_REFSCHEDULE_BOOK_REFRESH")
    Saving a file OFFLINE:
    Dim FName As String
    FName = InputBox(prompt:="Please enter filename")
    If FName = "" Then
    Application.DisplayAlerts = False
    ActiveWorkbook.Close
    Else
    ActiveWorkbook.SaveAs Filename:="c:\" & FName
    ActiveWorkbook.Close
    End If
    Application.DisplayAlerts = True
    Hope, that will help you
    Karsten

  • Stuck in a Rut trying to activate a Dialog from a menu item

    I am building an application using Netbeans. I am stuck on getting a dialog window to open when i select a menu item. I have tried numerous alternatives and still can not seem to get it to work. I am sure it is a simple one; except, I am starting to repeat myself on the changes. I have decided to ask for help.
    The menu item is "OpenProfileMenuItem" and the method is "OpenProfileMenuItemActionPerformed". The dialog is "ProfileForm". How do I make this work?
    package BBCUtillity;
    import org.jdesktop.application.Action;
    import org.jdesktop.application.ResourceMap;
    import org.jdesktop.application.SingleFrameApplication;
    import org.jdesktop.application.FrameView;
    import org.jdesktop.application.TaskMonitor;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.Timer;
    import javax.swing.Icon;
    import javax.swing.JDialog;
    import javax.swing.JFrame;
    public class BBCUtilityView extends FrameView {
    public BBCUtilityView(SingleFrameApplication app) {
      super(app);
      initComponents();
    @Action
    public void showAboutBox() {
      if (aboutBox == null) {
       JFrame mainFrame = BBCUtility.getApplication().getMainFrame();
       aboutBox = new BBCUtilityAboutBox(mainFrame);
       aboutBox.setLocationRelativeTo(mainFrame);
      BBCUtility.getApplication().show(aboutBox);
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {}// </editor-fold>
    private void OpenProfileMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
      ProfileForm iForm = new ProfileForm();
      // TODO add your handling code here:
    // Variables declaration - do not modify
    private javax.swing.JMenuItem ImportMainDataMenuItem;
    private javax.swing.JMenuItem MergeDataMenuItem;
    private javax.swing.JMenuItem NewProfileMenuItem;
    private javax.swing.JMenuItem OpenProfileMenuItem;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    // End of variables declaration                  
    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;
    private JDialog aboutBox;
    package BBCUtillity;
    import org.jdesktop.application.Application;
    import org.jdesktop.application.SingleFrameApplication;
    public class BBCUtility extends SingleFrameApplication {
    private mrkTable MarkerTable;
    @Override protected void startup() {
      show(new BBCUtilityView(this));
        MarkerTable = new mrkTable();
        MarkerTable.loadMarkers();
    //   MarkerTable.dumpTable();
    //   MarkerTable.saveMarkers();
    @Override protected void configureWindow(java.awt.Window root) {
    public static BBCUtility getApplication() {
      return Application.getInstance(BBCUtility.class);
      public static void main(String[] args) {
      launch(BBCUtility.class, args);
    package BBCUtillity;
    public class ProfileForm extends javax.swing.JDialog {
    /** Creates new form ProfileForm */
    public ProfileForm(java.awt.Frame parent, boolean modal) {
      super(parent, modal);
      initComponents();
      @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                         
    private void initComponents() {}// </editor-fold>                       
      private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {                                      
       // TODO add your handling code here:
    public void ProfileForm(String args[]) {
      java.awt.EventQueue.invokeLater(new Runnable() {
       public void run() {
        ProfileForm dialog = new ProfileForm(new javax.swing.JFrame(), true);
        dialog.addWindowListener(new java.awt.event.WindowAdapter() {
         @Override public void windowClosing(java.awt.event.WindowEvent e) {
          System.exit(0);
        dialog.setVisible(true);
    // Variables declaration - do not modify                    
    private javax.swing.JComboBox ModalCombo;
    private javax.swing.JComboBox ProfileCombo;
    private javax.swing.JComboBox PropCombo;
    // End of variables declaration                  

    This question should go into the Swing forum.
    I find the declaration, but no instance of OpenProfileMenuItem in your code (Java naming conventions request that variables start with lowercase characters). To this instance a listener must be attached, which when fired opens your dialog.

  • Documentation about Screen, Menu and Field Exits

    Hi all!!
    I need some documentation about Screen, Menu and Field Exits.
    I´m very interested specially on steps by steps.
    My mail is [email protected]
    Helpful posts will be rewarded.
    Thanks in advance and regards,
    Manuel.

    <b>Types of Exits </b>
    There are several different types of user exits. Each of these exits acts as hooks where you can attach or "hang" your own add-ons.
    <b>Menu Exits</b>
    Menu exits add items to the pulldown menus in standard SAP applications. You can use these menu items to call up your own screens or to trigger entire add-on applications.
    SAP creates menu exits by defining special menu items in the Menu Painter. These special entries have function codes that begin with "+" (a plus sign). You specify the menu item’s text when activating the item in an add-on project.
    <b>Screen Exits</b>
    Screen exits add fields to screens in R/3 applications. SAP creates screen exits by placing special subscreen areas on a standard R/3 screen and calling a customer subscreen from the standard screen’s flow logic.
    <b>Function Module Exits </b>
    Function module exits add functions to R/3 applications. Function module exits play a role in both menu and screen exits. 
    When you add a new menu item to a standard pull down menu, you use a function module exit to define the actions that should take place once your menu is activated. 
    Function module exits also control the data flow between standard programs and screen exit fields. SAP application developers create function module exits by writing calls to customer functions into the source code of standard R/3 programs. 
    These calls have the following syntax: 
    CALL CUSTOMER-FUNCTION ‘001’.
    Field Exits
    Field exits allow you to create your own programming logic for any data element in the Dictionary. You can use this logic to carry out checks, conversions, or business-related processing for any screen field.  Example: The data element BBBNR identifies a company’s international location number. You might want to set up your R/3 System so that all international location numbers are larger than 100. 
    The field exit concept lets you create a special function module that contains this logic. 
    You assign the special function module to the data element BBBNR. You then assign the module to any programs and screens in which users can add new international location numbers. When you activate your field exit, the system automatically triggers your special routine whenever a user enters a company location number. 
    In 4.6c, you can use "RSMODPRF" program to create field exits.
    An example of a user exits :-
    MODULE user_exit_0001 INPUT 
        CASE okcode.
            WHEN 'BACK OR EXIT'.
                CASE sy-dynnr.
                        WHEN '100'.
                             SET SCREEN 0.
                             LEAVE SCREEN.
                        WHEN '200'.
    **** Note that you can write any code that satisfy your needs.                                                     ****
    **** But in this case, this was wrote as a sample code for reference sake.                                    ****
    **** And you can test it.                                                                                ****
                             SET SCREEN 100.
                             LEAVE SCREEN.
                 ENDCASE.
          ENDCASE.
    reward  points if it is usefull..
    Girish

  • Premiere Elements 8 new install - all menu items grayed out

    New install of premiere elements 8. Installed 8.0.1 patch successfully. Installed Quicktime.
    SYSTEM
    Windows 7 64-bit
    Dell Inspiron 660
    8 GB RAM
    1 TB hard drive, 700 GB available after install
    All menu items are greyed out except for File | New, Open, Exit and some Help menu items. Will create a project but then does nothing. Reopening the empty project results in Elements/Pro compatibility message. Unusable.

    Thank you ATR. I followed your sequence of checks. RESOLVED BY DISABLING PORTION OF AV FUNCTIONS BEFORE LAUNCHING APPLICATION.  Here are the steps.
    I had not even tried Premiere Elements Organizer. When I did, it appeared to run fine and actually the AutoAnalyzer Options only appear under its Preferences menu, I later found out. Those options were then disabled with no change to the issue.
    I removed and reinstalled the program with an internet connection and McAfee firewall and AV off. And then ran the program with an internet connection.  No change.
    I deleted the Adobe Premiere Elements Prefs file first, and then the whole 8.0 Folder in which the Adobe Premiere Elements Prefs file exists. No change.
    The program was installed in the default c: drive location so no change there.
    The problem went away with antivirus and firewall(s) disabled!. I narrowed it down to what McAfee calls "Real-Time Scanning" under "Virus and Spyware Protection." The level of control McAfee LiveSafe-Internet Security affords under "Real-Time Scanning" is not very detailed. The setting that makes the difference is under "Scan These Files" is "Programs and documents only" instead of the default "All files (Recommended)."
    Now going back upstream, I enabled the firewall fully. Firewall makes no difference if I shut it off globally or allow individual program exceptions...it still runs fine. I also enabled all the AutoAnalyzer Options and program still runs fine. Perhaps this is a rabbit trail for non-resource-limited systems.
    Hopefully this helps others with the same problem.
    sf

  • Applescript open message menu items greyed out

    I've struck a real dilemma. When opening a Mail message with any sort of scripting, many of the menu items remain greyed out, including the one  that's important to me, 'Save Attachments...'.
    If I manually open the same message, the menu items are enabled.
    Try this script, by resetting the mailbox name to one of your own mailboxes, and you'll see what I mean.
    Anybody got any clues as how to fix this, please? (I've lodged a bug report).
    Regards
    set SaveAttachmentsMenu to true
    tell application "Mail"
      activate
      set WindowCount to count of windows
      open item 1 of messages of drafts mailbox
      set x to 0
      repeat # wait until the message is really open.
      tell current application to delay 0.1
      set x to x + 1
      if x > 40 then exit repeat
      if (count of windows) > WindowCount then exit repeat
      end repeat
      tell application "System Events" to tell process "Mail"
      select window 1
      tell current application to delay 0.2
      if exists menu item "Save Attachments…" of menu 1 of menu bar item "File" of menu bar 1 then
      keystroke "a" using command down
      if not enabled of menu item "Save Attachments…" of menu 1 of menu bar item "File" of menu bar 1 then say "attachments disabled"
      click menu item "Select All" of menu 1 of menu bar item "Edit" of menu bar 1
      set x to 0
      try
      click menu item "Save Attachments…" of menu 1 of menu bar item "File" of menu bar 1
      end try
      repeat until exists sheet 1 of window 1
      tell current application to delay 0.1
      set x to x + 1
      if x = 40 then
      set SaveAttachmentsMenu to false
      exit repeat
      end if
      end repeat
      end if
      end tell
    end tell
    SaveAttachmentsMenu

    'Mail' has been brutally cut off at the knees. No actual trying to send a click to any of its elements works any more.
    BAD Apple!
    I've tried the following without success. If only I could send a click to the first element, the required menu item would activate. 
    set SaveAttachmentsMenu to true
    tell application "Mail"
      activate
      set WindowCount to count of windows
      open item 1 of messages of mailbox "* items to store" # drafts mailbox
      set x to 0
      repeat # wait until the message is really open.
      tell current application to delay 0.1
      set x to x + 1
      if x > 40 then exit repeat
      if (count of windows) > WindowCount then exit repeat
      end repeat
      tell application "System Events" to tell process "Mail"
      tell current application to delay 1
      try
      select scroll area 1 of window 1
      click
      end try
      try
      tell scroll area 1 of window 1
      set {xPosition, yPosition} to position
      set {xSize, ySize} to size
      end tell
      -- modify offsets if hot spot is not centered:
      click at {xPosition + (xSize div 2), yPosition + (ySize div 2)}
      display dialog xPosition & tab & yPosition as text
      on error errmsg
      display dialog errmsg
      end try
      tell current application to delay 0.2
      if exists menu item "Save Attachments…" of menu 1 of menu bar item "File" of menu bar 1 then
      keystroke "a" using command down
      if not enabled of menu item "Save Attachments…" of menu 1 of menu bar item "File" of menu bar 1 then say "attachments disabled"
      click menu item "Select All" of menu 1 of menu bar item "Edit" of menu bar 1
      set x to 0
      try
      click menu item "Save Attachments…" of menu 1 of menu bar item "File" of menu bar 1
      end try
      repeat until exists sheet 1 of window 1
      tell current application to delay 0.1
      set x to x + 1
      if x = 40 then
      set SaveAttachmentsMenu to false
      exit repeat
      end if
      end repeat
      end if
      end tell
    end tell
    SaveAttachmentsMenu

  • TableView Context Menu Item shows up when run on Java 8 until update 5 but not on later ones

    The code below runs as its name says on Java 8 update 5 but not on later ones:
    public class TableViewShowingOnlyAnAppendContextMenuItemIfRowIsEmptyElseDeleteIsIncluded extends Application {
        private final TableView<Name> table = new TableView<>();
        private final ObservableList<Name> data = FXCollections.observableArrayList(new Name("Jacob"),
                new Name("Isabella"), new Name("Ethan"), new Name("Emma"), new Name("Michael"));
        public static void main(String[] args) {
            launch(args);
        @Override
        public void start(Stage stage) {
            TableColumn<Name, String> column = new TableColumn<>("Name");
            column.setCellValueFactory(new PropertyValueFactory<>("name"));
            table.getColumns().add(column);
            table.setItems(data);
            ContextMenu contextMenu = new ContextMenu();
            contextMenu.getItems().add(new MenuItem("append"));
            table.setContextMenu(contextMenu);
            table.setRowFactory(tableView -> {
                TableRow<Name> row = new TableRow<>();
                row.contextMenuProperty().bind(
                        Bindings.when(Bindings.isNotNull(row.itemProperty()))
                                .then(showOnlyAppendContextMenuItemIfRowIsEmptyElseIncludeDelete())
                                .otherwise((ContextMenu) null));
                return row;
            Scene scene = new Scene(table);
            stage.setScene(scene);
            stage.show();
        private ContextMenu showOnlyAppendContextMenuItemIfRowIsEmptyElseIncludeDelete() {
            ContextMenu rowMenu = new ContextMenu();
            ContextMenu tableMenu = table.getContextMenu();
            if (tableMenu != null)
                rowMenu.getItems().addAll(tableMenu.getItems());
            rowMenu.getItems().add(new MenuItem("delete"));
            return rowMenu;
        public static class Name {
            private final SimpleStringProperty name;
            private Name(String name) {
                this.name = new SimpleStringProperty(name);
            public String getName() {
                return name.get();
            public void setName(String name) {
                this.name.set(name);
    Can help me find the error in the code? Or if there is none, is this a regression that should be submitted? As of now, all the PCs in use have 8u5.
    Thanks in advance.

    Correctly answered by James_D:
    http://stackoverflow.com/questions/28195552/javafx-tableview-context-menu-item-shows-up-when-run-on-java-8-until-update-5-bu
    pasted below:
    The fix is to create new menu items that are copies of the ones in the table's context menu:
    private ContextMenu showOnlyAppendContextMenuItemIfRowIsEmptyElseIncludeDelete() {
    ContextMenu rowMenu = new ContextMenu();
    ContextMenu tableMenu = table.getContextMenu();
    if (tableMenu != null) {
    for (MenuItem item : tableMenu.getItems()) {
    MenuItem rowItem = new MenuItem(item.getText());
    rowItem.setGraphic(item.getGraphic());
    rowItem.setOnAction(item.getOnAction());
    rowMenu.getItems().add(rowItem);
    rowMenu.getItems().add(new MenuItem("delete"));
    return rowMenu;

Maybe you are looking for