Updating state of menu items

In Visual C++ I could write the handler for updating state
of menu items, which was automatically called
before menu was open.
Is there such a mechanism present in Swing,
or the programmer have to implement such a functionality
himself?

JPopupMenu.addPopupMenuListener(...) might be what you are looking for.

Similar Messages

  • C3software update problem multiple menu items

    i just updated the software on my nokia C3-00 and the menu now shows 2 COMMUNITIES icons. please help!!!

    Hey Samadali,
    Welcome to the Nokia Forums,
    Could you please plug your device in via USB and enter Mass Storage mode.
    If you enter the applications folder in mass storage mode you will be able to check if you have installed the .sisx file twice, if so, please delete one and hopefully that will only leave one copy of the application on your device.
    I hope this has helped!
    Sheldric
    Press the 'Accept As Solution' icon if I have solved your problem, Kudos my post if my advice has helped you!

  • Mouse state with menu items overlapping control

    Hi,
    I have an issue with retrieving the mouse location using GetGraphCoordsFromPoint...
    I am using the return status of GetGraphCoordsFromPoint to determine if the mouse cursor is above the plot area of my graph control (1) or not (0) in order to switch between the mouse styles (VAL_DEFAULT_CURSOR versus VAL_CROSS_HAIR_CURSOR).
    It works in most cases...
    On top of the panel there is a menu bar, located below is the xy graph. Now, if the mouse opens a menu and is over the menu (and also over the graph) the mouse style depends on mouse history:
    If the mouse has always been located over the menu, it is not recognized by GetGraphCoordsFromPoint to be loacted over the graph - which is what I would like to see, in this case the cursor style still is the default style.
    Now, if the mouse leaves the menu for a short distance, the menu does not disappear (only if the mouse is at a larger distance) and acccordingly GetGraphCoordsFromPoint realizes that the mouse is over the graph. This is correct and as expected, too.(the mouse style is changed to a cross hair then)
    Now, if I move the mouse back over the menu, this is not recognized by GetGraphCoordsFromPoint, unfortunately, and the mouse style is not switched back to default.
    Am I missing something, or is there a way to correct this behavior? Having different mouse styles over a menu is confusing for the user and I'd like to avoid that, of course
    Thanks....
    Solved!
    Go to Solution.

    Hi Wolfgang,
    There isn't a very good way to get around this problem. As you've found, panel move events are sent to the panel's callback even while a menu is being tracked, and when you change the mouse cursor this this also impacts any menu that might be active at the time.
    If you don't mind the cursor not changing at all while the menu is active, even if the user moves over the graph, then there is a possible strategy you can pursue to remedy the situation. It consists of trying to detect when a menu is active so that you don't try to change the cursor while the menu is active. Unfortunately, this is easier said than done. Although it's straightforward to be notified whenever a new menu becomes active (via a menu dimmer callback) there is no good way to be notified when the menu goes away. And there are multiple ways in which it can go away. So it it not possible for you to set an internal flag that tracks when the menu is active.
    However, it is possible to find out whether the menu is active at the time that you receive the panel move event (or in the timer tick event, although I'm not completely sure why you are also using a timer). You can't do it with the CVI UI library, but you can, using the Windows SDK, in a somewhat round-about way.
    The idea is to find out which window is the topmost window. And if it is not the panel window, then you should be able to assume that a menu is active and thus refrain from changing the cursor. Note that you also have to make sure that the active window belongs to your process, since there could be any number of other windows that could be the "topmost" window at any one time. But if it belongs to your process and it is not your panel, then we can assume that it's the menu.
    I did a quick test with the following code and it seems to work, although you might want to test it more thoroughly than I did:
    topHwnd = GetTopWindow (NULL);
    GetWindowModuleFileName (topHwnd, topHwndModule, MAX_PATHNAME_LEN);
    GetPanelAttribute (panel, ATTR_SYSTEM_WINDOW_HANDLE, (intptr_t *)&panelHwnd);
    GetWindowModuleFileName (panelHwnd, panelHwndModule, MAX_PATHNAME_LEN);
    if (!strcmp (topHwndModule, panelHwndModule) && panelHwnd != topHwnd)
        return 0; // don't change the cursor unless the panel really is on top
    Good luck,
    Luis

  • How to edit a locked menu item?

    Link Visitor is an add-on for Firefox. A recent update changed my menu items. I tried to use Menu Wizard to change the position of “toggle visited status” from the bottom of the pull-down menu to the top of the pull-down menu, but “toggle visited status” is the only option that is locked and greyed-out. A year or two ago I was able to use Menu Editor to move “toggle visited status” to the top of the menu. Any ideas? Thanks!
    MacBook Pro Retina 15" (mid-2014) 2.5 GHz Intel Core i7
    OS X 10.9.5
    Memory: 16 GB
    Graphics  NVIDIA GeForce GT 750M 2048 MB
    OWC ThunderBay 4
    Dell UltraSharp U2412M in vertical mode

    Hi,
    Read this article it will be useful.
    http://download.oracle.com/docs/cd/E10391_01/doc.910/e10362/custmenu.htm#sthref118,
    You can find customization document in OIM documentation folder.
    Regards
    Nitesh

  • Changing background gradient of menu items in TOC

    Hi,
    I know how to edit the playback swf files, but I can't find the TOC files (if there are any).
    I want to delete the gradient present in the default/rollover state for menu items in the table of contents. thanks!

    Hello,
    Which version of Captivate are you using? In CP5 you can change the rollover Text color and the Rollover background color to improve readability. In CP4 you can only change the background color. For both, have a look in the TOC settings.
    Lilybiri

  • Implementing menu items and saving state in my app

    Hello
    I'm a new user to the forums, but have a little bit of java programming experience.
    currently i'm writing some business applications, one of which is a payroll system. The target audience is end-user bookkeepers so i am planning for a GUI front end.
    My first question relates to how programs save their state. for example, each month the bookkeeper will launch the program and add the next months payments, or he/she will open the program to fix a mistake. In general how do programs like word, excel (or anything) save and load files to work with? I was thinking about using XML. I thought i would load in an XML file containing all work so far, and then the user could save to it, which would add the new work.
    Question the second: A lot of gui java apps i use (like argo, symphony etc) have standard menus at the tops. Items like open, save, close, print etc. How are developers actually doing this? is there some premade classes i can just use in my programs as well that would be me this funtionality? This kindof relates to my first question about saving and opening. Further, it seems there are two GUI libraries to consider - either SWT or Swring. Eclipse plugins are written in SWT (from what i have heard). Can anybody recommend which API i should be using to create a GUI for my program?
    I think that's it for now. If anybody can provide me with advice i woudl be most grateful, as i'm at a bit of a standstill with my development.
    thanks.
    Edited by: minofifa on Oct 25, 2007 1:09 PM
    attempted to take topic off the watch list - sorry guys

    My first question relates to how programs save their state. for example, each month the bookkeeper
    will launch the program and add the next months payments, or he/she will open the program to fix a
    mistake. In general how do programs like word, excel (or anything) save and load files to work with? I
    was thinking about using XML. I thought i would load in an XML file containing all work so far, and then
    the user could save to it, which would add the new work. It sounds more like you are talking about saving the data instead of state--save in a database for mass and long term storage. Simple state info can be easily save in a database also or in a bean or text file.
    Question the second: A lot of gui java apps i use (like argo, symphony etc) have standard menus at
    the tops. Items like open, save, close, print etc. How are developers actually doing this? is there
    some premade classes i can just use in my programs as well that would be me this funtionality? This
    kindof relates to my first question about saving and opening. Further, it seems there are two GUI
    libraries to consider - either SWT or Swring. Eclipse plugins are written in SWT (from what i have
    heard). Can anybody recommend which API i should be using to create a GUI for my program?Maybe this is not what you are asking, but menu systems are implemented with Menu, MenuBar, MenuItem, etc objects in Java. The specifics of what happens when the individual menu items are selected are left up to the programmer.
    If you are looking for prebuilt menubars with code attached to perform common functions, then I do not know of any included in Java.

  • How can I change the state of a runtime menu item programati​cally?

    Using LabView 6.1, I would like to change the state of the runtime menu item "Operate/Print at completion".
    The goal here is to print the VI front panel according to the operator choice (OK ->print, Cancel ->don't print)
    In a first release, I put a Stop function at the dialog output (activated by the cancel button) but this function stop the complete application and my idea where to stop only the VI in which the dialog is running.
    In a second release, I've tried to use the "Application
    control/Menu" but I receive every time an error:
    Error 88 occured at Cannot modify application menu item in the printtest.vi.
    Possible reasons: LabView, Runtime menu error...
    Any suggestion is appreciated.
    Re
    gards,
    phidu

    Instead of using the print at completion option, print the VI programatically if the user selects to print...open a reference to the VI you want to print and use an invoke node to print vi to printer.
    Alternatively create another VI with a layout optimized for printout, set it to print at completion and run and load the data into that VI if and only if the user OKs the print...
    Mads
    MTO

  • A top level menu item should display its active state if any of its submenu items are active

    Example case: I'm designing a Muse site which is basically a portfolio of our work. We design books, doing page layout and covers. We have numerous book categories and sub categories which I put in a horizontal menu. When a given top level category menu item doesn't have a submenu, it is a hyperlink and it displays active state when the browser displays its linked page. But when a given page is displayed from a submenu link, its top level menu item does NOT display active state. I think it should.
    For example, we have a "Nostalgia" category which has "Film" and "TV" subcategories. Because the menu item, "Nostalgia" has a submenu containing "Film" and "TV", the label "Nostalgia" is not a hyperlink. The submenu attached to it has the two hyperlinked items "Film" and "TV". When the browser is displaying either linked page, the submenu is hidden. So it would be nice if the top level item, "Nostalgia" would display in an active state.

    Hello Daniel,
    As of now this feature is not there in Adobe Muse.
    I would suggest you to please log this as a feature request in our "Ideas for features in Adobe Muse" section. (http://forums.adobe.com/community/muse/ideas)
    Hope this helps.
    Regards,
    Sachin

  • Menu item icon not updating

    Hi,
    I have an action into which I set an Icon:
    action.putValue(Action.SMALL_ICON, icon1);
    now I set this action into my menu item and show the item in a menu. The item displays correctly and the icon is visible.
    later in the program i do:
    action.putValue(Action.SMALL_ICON, icon2);
    then I open the menu but the menu item still shows icon1 until I roll over it with the cursor when it finally changes to icon2.
    Any ideas on how to make this update immediate?
    BTW at the point of changing the icon, I don't have access to the menu item or the frame etc, just the action.
    Thanks a lot,
    Jim

    Anyone got any more ideas?Maybe you have a programming problem, but we can't see your code so we don't know for sure.
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

  • Menu item moves in active state

    I'm using the "Right Icon" to implement a long vertical seperator between menu items:
    laurensilverceramics.businesscatalyst.com
    I've deleted the Rollover, Mouse-Down and Active states of the menu items.  But when a menu item becomes active - it move put by 20 pixels or so.  Any idea on how I can fix this?

    Hi Ryan,
    From looking at the navigation on the site and the corresponding code, it seems you are using a Composition Widget rather than a Menu Widget. The code generated for the Industries link is different than the others as if in its case, the link was applied to chunks of text/content inside the trigger rather than the trigger itself. Recreating that particular item in the composition and applying link just like others should apparently fix this. I would appreciate if you could send your current .muse file to [email protected] along with a reference to this forum thread and mark it to my attention in the Subject? If the file is larger than 20MB, please use an online file sharing service such as WeTransfer or YouSendIt.
    Cheers,
    Vikas

  • Is it possible to get menu item checked state?

    In a script I need to know the state of a menu items checked state - e.g. the View/Proof Colors menu item.
    Is that possible? (and of cause if it is how do I do it?)
    Thanks,
    Jack

    The reason I need the state of "Proof Colors" is that I want to turn on/off the visibility of a layer set depending on its state.
    In the layer set I would have my printing adjustments layers. This way it is very easy to compare the image with the softproof. When "Proof Colors" is turned off the printing adjustment layer set would also be turned off - displaying the image without any printing corrections.
    When "Proof Colors" is turned on the printing adjustment layer set would also be turned on - displaying the softproof with printing corrections applied.
    Jack

  • Dynamically Updating Menu Item selection foreground

    I am trying to update MenuItem.selectionForeground color depending on whether the menu item is selected or not. However the menu item fails to update.
    import javax.swing.*;
    import javax.swing.border.Border;
    import javax.swing.border.EmptyBorder;
    import java.awt.*;
    import java.awt.event.*;
    public class ToggleMenuItem extends JMenuItem implements ItemListener, MouseListener
         private Color selectColor;
         private Color unSelectcolor;
         private Insets m_ins = new Insets(4,4,4,4);
         private ImageIcon imgSelected;
         private ImageIcon imgUnselected;
         protected Border m_inactive = new EmptyBorder(3, 3, 3, 3);     
         public ToggleMenuItem(Action act, boolean b,String display , ImageIcon imgUnselected,
         ImageIcon imgSelected, Color unSelectcolor, Color selectColor)
              super(display);
              this.selectColor = selectColor;
              this.unSelectcolor = unSelectcolor;
              this.imgSelected = imgSelected;
              this.imgUnselected = imgUnselected;
              setMargin(m_ins);
              setRequestFocusEnabled(false);
              addActionListener(act);
              addItemListener(this);
              setModel(new JToggleButton.ToggleButtonModel());
              setFocusable(false);
              setIcon(imgUnselected);
              setForeground(unSelectcolor);
              setBorder(m_inactive);          
              addMouseListener(this);
         public void setEnabled()
              if ( isSelected() )
                   setForeground(selectColor);
                   setIcon(imgSelected);               
              else
                   setForeground(unSelectcolor);
                   setIcon(imgUnselected);                              
         public void itemStateChanged(ItemEvent e)
              setEnabled();
         public void mouseEntered(MouseEvent e)
              if(!isSelected())
                   UIManager.put("MenuItem.selectionForeground", Color.white);
    //updateUI();
              else
                   UIManager.put("MenuItem.selectionForeground", Color.black);
    //updateUI();
         public void mouseClicked(MouseEvent e) {}     
         public void mouseExited(MouseEvent e) {}     
         public void mousePressed(MouseEvent e) {}
         public void mouseReleased(MouseEvent e) {}
    Pay special attention to the mouseEntered function

    Have u tried
    SwingUtilities.updateComponentTreeUI( component );

  • Menu items dimmed after installing latest security update

    has anyone else seen this problem? after installing the latest security update 2008-02 on my macbook, file menu and other items are dimmed (grayed out) after a restart. i have to right click on the desktop to bring up the contextual menu before the menu items become available. after that, the machine works as expected. the problem does not exist on my intel imac, which has identical software installed. it's more an annoyance than a big problem, but does anyone have a clue about how to fix it? i've tried trashing preference files for the finder, but that didn't seem to work. thanks in advance.

    well, i couldn't figure it out, so i reinstalled leopard and updated it to 10.5.2 with the latest security update and everything is working normally. something must have been broken in my previous set up.

  • 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;

  • Can Dropdown menu item stay on the "roll over" state while the user's mouse is hoving over the sub

    Can Dropdown menu item stay on the "roll over" state while the user's mouse is hoving over the parent's sub-menus?
    Thanks

    Thanks for the response. My main goal here is to get the drop
    down menu word "Overview" to remain red once it reaches the frame
    "WhoWeAre" or "OurMission" on the main timeline. If I turn the
    button inside the movie clip into an MC to do this, the drop down
    menu no longer works. Any thoughts on how to get this drop down
    menu to do this?

Maybe you are looking for