Event when a Menu in a MenuBar is shown

Is there a way to detect when a Menu in a MenuBar is shown?

In essence, a menu is a button with an associated JPopupMenu. When the "button" is pressed, the JPopupMenu appears. If the "button" is on the JMenuBar, the menu is a top-level window. If the "button" is another menu item, then the JPopupMenu is "pull-right" menu.

Similar Messages

  • RAISING AN EVENT WHEN DATABASE TABLE UPDATES

    hi all,
             i want to raise an event when database table updates.For eg : if a price of a material has been changed then i have to raise an event and run the abap program in back ground.i know transaction SM62 to create event, i dont know about transaction SM64. please give me the procedure how to solve this problem. i dont know work flow. please give me a sample code how to raise event.
    thanka and regards
    suresh

    Hi Suresh
    It is important to understand that the SAP architecture abstracts the database from the application.
    I think that you should look for ways that the application triggers an event when an update has taken place, rather than the DB.
    Two ways of doing this that spring to mind are change pointers (for the ALE interface, see menu SALE) and Business Transaction Events (various things including CRM integration, see menu FIBF).
    The latter works very well for sending prices to CRM when they change. I am more familiar with this than ALE so I will discuss it.
    If you go to menu FIBF and then follow menu path Environment -> Info System (P/S), and then run the report for event 00503301, you can find documentation and a sample function module that you can copy.
    Once you register your new function module in the event tables then it will be called when prices are changed.
    Cheers
    Dom

  • How to make menu to auto close when a menu item is selected?

    hi ...my question is described above..
    to make things clearer i have written a mini code to demonstrate my problem
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    /* just a frame with a JMenuBar with a JMenu with two RadioButtons
    public class myFrame2 extends JFrame implements ActionListener{
         JMenuBar mb ;
         JMenu mi;
         JRadioButton rb1;
         JRadioButton rb2;
         public myFrame2(){
              super();
              mb = new JMenuBar();
              mi = new JMenu("New");
              rb1 = new JRadioButton("Button 1");
              rb1.addActionListener(this);
              rb1.setActionCommand("action1");
              rb2 = new JRadioButton("Button 2");
              rb2.addActionListener(this);
              rb2.setActionCommand("action2");
              mi.add(rb1);
              mi.add(rb2);
              mb.add(mi);
              setJMenuBar(mb);
              pack();
              setVisible(true);
         @Override
         public void actionPerformed(ActionEvent e) {
              // Do something......
         public static void main(String args[]){
              new myFrame2();
    }If you run this program you will see that when you select a RadioButton the menu doesn't hide ...
    How can i make it hide when a menu item (JradioButton) is selected?
    thanks in advance
    Edited by: Pitelk on Jun 10, 2008 7:42 AM

    On a menu use JRadioButtonMenuItem.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class JRadioButtonMenuItemExample {
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    launch();
        static void launch() {
            JMenuBar mb = new JMenuBar();
            JMenu menu = new JMenu("menu");
            mb.add(menu);
            ButtonGroup bg = new ButtonGroup();
            JRadioButtonMenuItem item1 = new JRadioButtonMenuItem("alpha");
            bg.add(item1);
            menu.add(item1);
            JRadioButtonMenuItem item2 = new JRadioButtonMenuItem("beta");
            bg.add(item2);
            menu.add(item2);
            JRadioButtonMenuItem item3 = new JRadioButtonMenuItem("gamma");
            bg.add(item3);
            menu.add(item3);
            JFrame f = new JFrame();
            f.setJMenuBar(mb);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setSize(400, 300);
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • Detect when context menu opens or closes

    Is there an easy way to detect when a (righ-click) context
    menu is visible? I wish there was a "visible" property for the
    Contextmenu class, but there isn't one.
    I've tried to listen to events to know when the menu opens or
    closes but it would seem as though there are far too many
    (undocumented) events to take into account and some of the events
    may be OS specific.
    For example, the following 3 events cover much of the
    scenarios of when the menu opens/closes...
    cmMenu.addEventListener(ContextMenuEvent.MENU_SELECT,
    onShow);
    cmMenu.addEventListener(Event.DEACTIVATE, onHide);
    stage.addEventListener(MouseEvent.MOUSE_DOWN, onHide);
    But you can also click either the f10, alt, esc, or enter
    keys to also close the menu. There could be other ways to close the
    menu, but since it is not well documented, I can't be certain.
    Too bad Event.CLOSE isn't dispatched when the menu closes.
    If anyone knows of a resource that documents how to determine
    when a context menu is opened or closed, please let me know.
    thanks! :-)

    Hello,
    I'm also having problems with this topic.  I'm developing an AIR app that uses context menus, and I've noticed that if I bring up a context menu, mouse around it and highlight items, but DON'T select them (i.e. click off to close the menu) that the main application loses focus.  There seems to be an invisible window or something blocking mouse events, until I move the app or do a command-~ (I'm on a Mac...it's as if there are multiple open windows and this toggles them.)  Note that this only seems to happen in the exact sequence above - selecting an item or avoiding the items altogether after the menu pops up results in the correct (expected) behavior when the menu closes.
    I'd like to be able to catch a close event of some kind for the context menu, and even better, find a way to prevent the problem described above.
    Below is a very simple AIR app that will demonstrate the problem. (I'm compiling with Flex 3.4.1 framework and running it on Snow Leopard...)  Much thanks in advance to anyone who can help me with this problem!
    -Chris
    <mx:WindowedApplication layout="absolute" applicationComplete="init()"
    xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
    <![CDATA[
    private function init():void {
    // Listener to trace mouseX property
    myCanvas.addEventListener(MouseEvent.MOUSE_MOVE,
    function (e:MouseEvent):void {
    trace(myCanvas.mouseX);
    // Create a simple context menu
    myCanvas.contextMenu= new ContextMenu();
    myCanvas.contextMenu.addItem(new NativeMenuItem("test"));
    ]]>
    </mx:Script>
    <mx:Canvas id="myCanvas" height="50%" width="50%" backgroundColor="0x00FF00"/>
    </mx:WindowedApplication>

  • How come when I send a picture with iPhoto email it always send the same picture event when I choose a different picture until I log out from iPhoto

    how come when I send a picture with iPhoto email it always send the same picture event when I choose a different picture until I log out from iPhoto

    Why? Because something is wrong.
    As a Test:
    Hold down the option (or alt) key and launch iPhoto. From the resulting menu select 'Create Library'
    Import a few pics into this new, blank library. Is the Problem repeated there?

  • Is there a way to detect the event when device goes to sleep and the screen blackens?

    I want to detect the event when the iOS device goes to sleep and the screen blackens?
    Is there any way to do it?

    Hi,
    A small idea, please check whether it will work or not.
    You can achieve this by using combination of DNS server and reverse proxy server.( Customized apache). Make 'A' record for www.abcd.com to reverse proxy server IP address in your DNS.
    So it will resolve your reverse proxy IP address for requests.
    Configure appche to accept incoming request for www.abcd.com and points towards www.abcd.com/parameters.
    I think this will solve your problem.  Only one condition is that proxy server will communicate with www.abcd.com on behalf of client.
    Follow the link for configuration of reverse proxy server
    http://www.slashroot.in/how-configure-basic-apache-reverse-proxy
    HTH
    Naisam

  • How to add an attachment to a google calendar event when uisng safari

    how to add an attachment to a google calendar event when uisng safari?

    A similar question/answer here How can I detect end of HTML5 video and do something?
    See if that helps
    Darrell

  • Why does ical put a random time in front of added events when I print?

    How can I prevent ical from putting a random time in front of added events when I print?

    In Word go to File, Options, Display and uncheck the box to print document properties.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • Splitting events when capturing footage from tape

    Using Final Cut Pro x, I want to capture footage from tape which is of a more then one event. what is the best way of doing this so as to avoid all of the footage captured as one event.

    One way of doing this is to simply go into the Import from Camera window and select the clips that belong to one event then hit the Import Selection button.  A window will come up asking you which event you want to import to and also give you the option to create a new event.  After the little clocks fill up on each of the selected clips, that import is done.  Now you can select the other clips and import them in the same way specifying a new event when you are asked where they are to go.  Best wishes.
    stpehen

  • Help using app_standard.event(when-tab-page-changed')

    Hello ,
    I need to create a form with the following requirements . There is one content canvas which contains a tabbed canvas and on this there are two stacked canvases .
    The problem is that when I compile my form and ftp to oebs , I cannot view the tab pages on the canvas .
    I see only my the fields displayed in the first tab page without the 'tab pages'.
    How do I solve this issue please ?
    My when-page-page-trigger contains the following :
    BEGIN
         APP_STANDARD.EVENT('WHEN-TAB-PAGE-CHANGED');
    if name_in('system.cursor_block') = 'XX_ERROR_MANAGEMENT' then
    if not form_success then
    -- Revert tab to prior value and exit
    set_canvas_property('CAN_INT',topmost_tab_page,name_in('system.tab_previous_page'));
    return;
    end if;
    -- Move to first item on each tab
    if target_canvas_name = 'CAN_INT' then
         SHOW_VIEW('CAN_ONG1');
    go_item('XX_ERROR_MANAGEMENT.INTERFACE_TYPE');
    else
    show_view(target_canvas_name);
    end if;
    END IF;
    END;
    Any help will be much appreciated . Thanks .

    bump

  • Raise an event when an idoc invoice (INVOIC02) gets created in error

    Hi All,
    I’m trying to generate an email message from an output invoice when processed incorrectly.
    I created a subtype of IDOCINVOIC, updated the linkage table using swe2  but the events are not raised when I go to re-issue my invoice output.
    I know it’s possible to raise these events in idoc invoice exit ZXEDFU02 but  the status is not created at this stage.
    Is it possible to raise an event when an idoc invoice gets created in error?
    King Regards
    Ann

    @CoolDadTX -That's because I've written com servers in the past using VB.net, however they were not registered with the Running object table.
     What I'm trying to do in this case is have an application that will be started by the user, and then they will start another application written in .Net to connect to that first application.  The reason for this is that we have an application
    written in an old version of smalltalk that doesn't seem to support getObject but can create an IUknown, and we already have base classes to attach to COM objects written in .Net.  As this new application needs to be started first it can't be tightly
    coupled to the legacy application, so we are trying to register the new application and then connect a Dotnet Client that is being started through a  COM Interface from the legacy application.  I know it's convoluted but we need to keep the legacy
    application alive for a bit longer while we rewrite it as an add-in for the new application.
    The article that you linked to has been very helpful on the server side, but do you have any ideas as to how I can connect the sink on the client side in C#?

  • Triggering event when entries inserted in standard table

    Hi Experts,
    I've a requirement to trigger an custom event when entries created in table TOA01 table. We can do this for Z-tables by through options available in table maintenance generator screen. But, in my case its standard table, so i cant change the table. And I dont want to use change document objects. Can you please let me know is there any other method to achieve this.
    Thanks in Advance,
    Siva Sankar.

    Have you checked that if there is a standard event triggered when an entry is done to this table? I think that there might be. If an event is triggered, you can for example create a check function module, and trigger your own event from there.
    Regards,
    Karri

  • Trap event when Application server is shutdown

    Hi All,
    Actually I want to catch an event do something when weblogic server is shutdown.
    How can I catch the event.
    Any help would be highly appreciated.
    I tried by implementing ServletContextListener interface, but in that I can only catch the event when weblogic is started, but not when it is shutdown.

    Why not? ServletContextListener.contextDestroyed() will always be triggered when the container is shutting down.

  • Catch event when Application Server is shutdown

    Hi All,
    Actually I want to catch an event do something when weblogic server is shutdown.
    How can I catch the event.
    Any help would be highly appreciated.
    I tried by implementing ServletContextListener interface, but in that I can only catch the event when weblogic is started, but not when it is shutdown.

    Create a class that implements the ServletContextListener interface:
         public class myServletContextListener implements ServletContextListener
    The ServletContextListener interface has two methods that must be implemented:
         public void contextInitialized(ServletContextEvent sce)
         public void contextDestoyed(ServletContextEvent sce)
    Register the listener in the web.xml:
         <web-app>
              <context-param>
                   <param-name>param1</param-name>
                   <param-value>paramValue1<param-value>
              </context-param>
              <listener>
                                                     <listener-class>
                                                                com.listeners.MyServletContextAttributeListener
                     </listener-class>
              </listener>
              <servlet>
                   <servlet-name>test</servlet-name>
                   <servlet-class>com.test</servlet-class>
                   <init-param>
                        <param-name>param1</param-name>
                        <param-value>paramValue1</param-value>
                   </init-param>
                   <load-on-startup>1</load-on-startup>
              </servlet>
              <servlet-mapping>
                   <servlet-name>test</servlet-name>
                   <url-pattern>/test</url-pattern>
              </servlet-mapping>
         </web-app>When the server starts up the servlet context (usually on server start up) it will call the contextInitialized method of your myServletContextListener class. When the server shuts down the servlet context (usually on server shutdown) it will call the contextDestroyed method of your myServletContextListener class.
    With in these methods you can usually assume that the server is starting/stopping and do what it is you wish to do.
    However there are two things to bear in mind:
    1- Most servers offer a manager app that allows individual servlet contexts to be stopped/started without shutting down the server o you may get false results depending on you is managing the server.
    2- I am not sure if the methods will be called if the server suffers a catastrophic error and crashes. For example a out of memory error. So you may miss a server shut down but the error should be logged in the tomcat log files.

  • No key event when compose keys are pressed

    I am supporting a legacy application for Sabre which maps some of the keys differently. For example, on a French keyboard the Compose key which is used to put a ^ on top of the vowel characters is to be remapped to produce a special character called a "Change Character" that has a special use for reservation agents that use Sabre
    The problem is, the first time you press the ^ compose key there is no key event apparently because the VM figures it doesn't yet know what key to report, it is expecting you to press a character such as 'o' and then you get an 'o' with a '^' on top of it.
    If you press the ^ compose key a second time, you get the following key events:
    keyPressed
    keyTyped
    keyTyped
    keyReleased
    On the screen you will see two ^ characters appear. Currently I remap the ^ character to the "Change Character", and I suppress the second keyTyped event so that I only get one character. The problem is that the user ends up having to press the key twice to get one "Change Character."
    I have no fix for this problem because there is no key event produced when they press the ^ compose key the first time.
    By the way, this behavior appears to have been introduced with jdk 1.3. The older jdk did produce a key event the first time you pressed the compose key. I would expect that this behavior was considered to be a bug and was fixed in jdk 1.3.
    Is there some other way to detect when the user presses a compose key? If not, is it possible for future jdk releases to report a keyPressed event when a compose key is pressed? This event would not cause a character to appear on the screen, but would allow programs to detect when the compose key is pressed.
    There is already a key on the French keyboard that behaves this way. It is the key to the left of the '1' key and it has the pipe symbol on it. If you press Shift plus this pipe key, no character is produces but a keyPressed event with a keycode of 222 is produced. I merely point this out to show that there is a way to report key events whithout producing output on the screen.
    Thanks, Brian Bruderer

    I don't know if this actually helps, but it seems that you can bind an Action to a dead key like the circumflex of the French keyboard
    Keymap keymap = textPane.addKeymap("MyEmacsBindings", textPane.getKeymap());
    Action action = getActionByName(DefaultEditorKit.beginAction );
    KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_DEAD_CIRCUMFLEX);
    keymap.addActionForKeyStroke(key, action);I saw this on a Swing tutorial and modified it slightly. Have a look at it :
    http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html
    Chris

Maybe you are looking for

  • In sales order the total doc value

    when ever i created a sales order, the customer should pay amount 50% in order value then only system will allow to delivery automatically otherwise system should not allow to delivery. How it is possible please give me solution.

  • Hiding individual row in JTable..Urgent

    Hi, I want to hide a row in a JTable when i select hide option from a popupmenu and bring it back when i select show from the menu.I did the same done for columns by setting column width to a minimum value and then restoring it to the initial size.Bu

  • Debug from a Remote Location

    I installed the update to Flash 8 that allows for remote debugging, and I had it all set up and working over the past week or two. But, all of a sudden it's not working for me anymore. I was able to access it by right clicking my movie from within th

  • What happened to Photo Mail?

    Why can't I find "Photo Mail" under the Share tab?

  • 4K export issue on Premiere Pro CC

    Hi! I recently purchased Sony FDR AX100 4K comcorder. I exported the same footage  in Premiere Pro CC (Trial Version) and Premiere Pro CS6 using the same exporting setting, H264 bitrate 80. When I play using the VLC player into my computer,  the one