Listening for bubble-clicked event on trayicon

i'm trying to listen to mouse clicks on balloon messages that are displayed when you call TrayIcon#displayMessage.
i added an action listener (TrayIcon#addActionListener), which gets called, but it also gets called when you double-click
on the tray icon itself, so i want to differentiate between clicking on a balloon message and double-clicking on the tray icon.
its basically the same question as in two previous threads, but one of the administrators (DarrylBurke) said i needed to create a new thread.
http://forums.sun.com/thread.jspa?threadID=5284529&tstart=0
http://forums.sun.com/thread.jspa?threadID=5403857&tstart=0
any ideas appreciated.

a code sample doesn't help when the functionality of a balloon action listener doesn't exist.
anyhow, it looks like the original jdesktop project had the concept of adding a balloon listener:
http://download.java.net/javadesktop/swinglabs/releases/0.8/docs/api/org/jdesktop/jdic/tray/TrayIcon.html
specifically method TrayIcon#addBalloonActionListener, which lets one listen for interaction with a balloon message.
looks like that functionality was lost/not added to the java.awt version of the system tray class.

Similar Messages

  • Multiple Buttons in JTable Headers:  Listening for Mouse Clicks

    I am writing a table which has table headers that contain multiple buttons. For the header cells, I am using a custom cell renderer which extends JPanel. A JLabel and JButtons are added to the JPanel.
    Unfortunately, the buttons do not do anything. (Clicking in the area of a button doesn't appear to have any effect; the button doesn't appear to be pressed.)
    Looking through the archives, I read a suggestion that the way to solve this problem is to listen for mouse clicks on the table header and then determine whether the mouse clicks fall in the area of the button. However, I cannot seem to get coordinates for the button that match the coordinates I see for mouse clicks.
    The coordinates for mouse clicks seem to be relative to the top left corner of the table header (which would match the specification for mouse listeners). I haven't figured out how to get corresponding coordinates for the button. The coordinates returned by JButton.getBounds() seem to be relative to the top left corner of the panel. I hoped I could just add those to the coordinates for the panel to get coordinates relative to the table header, but JPanel.getBounds() gives me negative numbers for x and y (?!?). JPanel.getLocation() gives me the same negative numbers. When I tried JPanel.getLocationOnScreen(), I get an IllegalComponentStateException:
    Exception in thread "AWT-EventQueue-0" java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location
    Can someone tell me how to get coordinates for the button on the JTableHeader? Or is there an easier way to do this (some way to make the buttons actually work so I can just use an ActionListener like I normally would)?
    Here is relevant code:
    public class MyTableHeaderRenderer extends JPanel implements TableCellRenderer {
    public MyTableHeaderRenderer() {
      setOpaque(true);
      // ... set colors...
      setBorder(UIManager.getBorder("TableHeader.cellBorder"));
      setLayout(new FlowLayout(FlowLayout.LEADING));
      setAlignmentY(Component.CENTER_ALIGNMENT);
    public Component getTableCellRendererComponent(JTable table,
                                                     Object value,
                                                     boolean isSelected,
                                                     boolean hasFocus,
                                                     int row,
                                                     int column){
      if (table != null){
        removeAll();
        String valueString = (value == null) ? "" : value.toString();
        add(new JLabel(valueString));
        Insets zeroInsets = new Insets(0, 0, 0, 0);
        final JButton sortAscendingButton = new JButton("1");
        sortAscendingButton.setMargin(zeroInsets);
        table.getTableHeader().addMouseListener(new MouseAdapter(){
          public void mouseClicked(MouseEvent e) {
            Rectangle buttonBounds = sortAscendingButton.getBounds();
            Rectangle panelBounds = MyTableHeaderRenderer.this.getBounds();
            System.out.println(Revising based on (" + panelBounds.x + ", "
                               + panelBounds.y + ")...");
            buttonBounds.translate(panelBounds.x, panelBounds.y);
            if (buttonBounds.contains(e.getX(), e.getY())){  // The click was on this button.
              System.out.println("Calling sortAscending...");
              ((MyTableModel) table.getModel()).sortAscending(column);
            else{
              System.out.println("(" + e.getX() + ", " + e.getY() + ") is not within "
                                 + sortAscendingButton.getBounds() + " [ revised to " + buttonBounds + "].");
        sortAscendingButton.setEnabled(true);
        add(sortAscendingButton);
        JButton button2 = new JButton("2");
        button2.setMargin(zeroInsets);
        add(button2);
        //etc
      return this;
    }

    I found a solution to this: It's the getHeaderRect method in class JTableHeader.
    table.getTableHeader().addMouseListener(new MouseAdapter(){
      public void mouseClicked(MouseEvent e) {
        Rectangle panelBounds = table.getTableHeader().getHeaderRect(column);
        Rectangle buttonBounds = sortAscendingButton.getBounds();
        buttonBounds.translate(panelBounds.x, panelBounds.y);
        if (buttonBounds.contains(e.getX(), e.getY()) && processedEvents.add(e)){  // The click was on this button.
          ((MyTableModel) table.getModel()).sortAscending(column);
    });

  • Adobe plugin For Mouse Click Event Handler

    Hi All, How to write plugin For Mouse Click Event Handler? Please reply quickly..
    Thanks in Advance

    AS has already been replied to you on the other threads.
    THE ACROBAT SDK has all the information you need to implement your solution. If you investigate the SDK and find a specific part of implementing your solution that is causing a problem. Then post that specific problem on the forum so that Leonard/PDL/ Aandi/Everyone else, can help you with specific problems.
    This question is too open ended for it to be easily answered with out doing a lot of work.
    Please download the SDK.
    Investigate the Documentation/Samples.
    Start developing your plug-in. ( I would recommend the Acrobat-plug-in wizard)
    And if you hit a specific problem we will be happy to try and help.
    Please note MULTIPLE POSTS just annoy.
    HTH
    Malky

  • How to make component listen for a specific event of another component

    for example, i have several buttons and want them listen for a TreeSelectionEvent... in case anything selected they become active
    i don't want a JTree component activate these buttons...

    here's an overkill,
    import java.util.*;
    abstract class DoWhatever {
        public static Hashtable ht = null;
        public static Object DoWhat( String s, Object obj ) {
         if( null == ht ) {
             ht = new Hashtable();
             ht.put( ThisDoWhatever.NAME, new ThisDoWhatever() );
             ht.put( ThatDoWhatever.NAME, new ThatDoWhatever() );        
         return ( (DoWhatever) ht.get( s ) ).doWhatever( obj );
        public abstract Object doWhatever( Object obj );
    class ThisDoWhatever extends DoWhatever {
        public final static String NAME = "this";
        public Object doWhatever( Object obj ) {
         System.out.println( NAME );
         return null;
    class ThatDoWhatever extends DoWhatever {
        public final static String NAME = "that";
        public Object doWhatever( Object obj ) {
         System.out.println( NAME );
         return null;
    public class DoThisOrThat {
        public static void main( String[] args ) {
         DoWhatever.DoWhat( args[ 0 ], null );
    }

  • Air for iOS 7 App  - Listen for wireless Keyboard events

    Greetings i've been reviewing this older posting relating to the same problem that I have, but cannot surmise the solution from the thread. Could someone help point me in the right direction?
    https://forums.adobe.com/message/5618417
    I've built a flash ios app that relies on the input from 5 keys to function. I'm using Flash CS6 and AIR 13.0.0.111 for iOS. The app wont recognize the input from my bluetooth keyboard though.
    This code works until loaded onto the iPhone:
    stage.addEventListener(KeyboardEvent.KEY_DOWN, ScrollDown);
    function ScrollDown(e:KeyboardEvent):void{
    if (e.keyCode == 83){
    I guess in need to use a event.CHANGE listener but I can't find any similar tutorials to follow.
    Any help would be greatly appreciated.

    I don't know how wireless keyboard work for iDevices...
    Try to add StageText, tap on it and try to edit text using your keyboard. Could StageText hook keyboard input?

  • Listen for JTabbedPane scroll events

    I want to execute a method each time the op scrolls through the tabs in a JTabbedPane in "SCROLL_TAB_LAYOUT". I have tried implementing ChangeListener, propertychangelistener and componentlistener but none of them seem to notify me when the op scrolls through tabs?
    Thanks in adavce
    Calypso

    Thanks Camickr, sorry for the late reply below is working solution
    These are my custom actions which extends wrappedAction
      class ScrollRight extends WrappedAction {
            public ScrollRight(JComponent component, KeyStroke keyStroke) {
                super(component, keyStroke);
            public void actionPerformed(ActionEvent e) {
                this.invokeOriginalAction(e);
                System.out.println("\nScrolling Right");
      class ScrollLeft extends WrappedAction {
            public ScrollLeft(JComponent component, KeyStroke keyStroke) {
                super(component, keyStroke);
            public void actionPerformed(ActionEvent e) {
                this.invokeOriginalAction(e);
                System.out.println("\nScrolling Left");
      }This code was added to my constructor
          KeyStroke right = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.CTRL_MASK);
          KeyStroke left = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.CTRL_MASK);
          InputMap im = tabbedPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
          im.put(right, "scrollTabsForwardAction");
          im.put(left, "scrollTabsBackwardAction");
          ScrollLeft sl =   new ScrollLeft(tabbedPane,left);
          tabbedPane.getActionMap().put(sl.getValue(Action.NAME),sl);
          ScrollRight sr =   new ScrollRight(tabbedPane,right);
          tabbedPane.getActionMap().put(sr.getValue(Action.NAME),sr);Thanks again
    Calypso

  • Make child node listen for parent's event

    Is it possible?and how?

    parent.addEventListener("someEvent",functionInChildComponet);
    or parentApplication, or parentDocument, or
    Application.application...
    Tracy

  • Listening for click event

    I am curious, how can you have a child mxml page listen for
    an event from the parent?
    Let's say you have a button, call it 'btn1' on page1.mxml and
    you want to listen for the click event on page2.mxml. So far this
    is what I have:
    page1.mxml:
    <mx:Button id="btn1" />
    page2.mxml:
    <mx:Script>
    <![CDATA[
    private function btnListener(e:MouseEvent){
    Application.application.btn.addEventListener(MouseEvent.CLICK,
    setState(1));
    ]]>
    </mx:Script>

    "spacehog" <[email protected]> wrote in
    message
    news:glljts$g04$[email protected]..
    >I am curious, how can you have a child mxml page listen
    for an event from
    >the
    > parent?
    >
    > Let's say you have a button, call it 'btn1' on
    page1.mxml and you want to
    > listen for the click event on page2.mxml. So far this is
    what I have:
    >
    > page1.mxml:
    >
    > <mx:Button id="btn1" />
    >
    > page2.mxml:
    >
    > <mx:Script>
    > <![CDATA[
    >
    >
    > private function btnListener(e:MouseEvent){
    >
    Application.application.btn.addEventListener(MouseEvent.CLICK,
    > setState(1));
    > }
    > ]]>
    > </mx:Script>
    Check out Q3:
    http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf

  • Listening for click event on an af:image tag

    Dear All,
    Can anybody help me why my code does not work.
    Use case, using an Image, i wanted to call a managed bean method whenever I clicked the image. So here is what I did, I added a clientlistner
    and wait for the click event. Also a server listener is attached to the image.
    <af:image >
         <af:clientListener type="click" method="handleImageClick"/>
         <af:serverListener type="ImageEvent"
                           method="#{viewScope.MyBean.handleImageEvent}"/>
    </af:image>...and here is my javascript...
    <f:facet name="metaContainer">
         <af:resource type="javascript">
           function handleImageClick(evt)
                var comp = evt.getSource();
                AdfCustomEvent.queue(comp, "ImageEvent",{ fvalue : comp.getSubmittedValue()},false);
                evt.cancel();
         </af:resource>
    </f:facet>..and here is my managed bean method.
    public void handleImageEvent(ClientEvent ce)
    }I jsut dont know why it does not call my managed bean method. Is there any mistake in my code?
    JDEV 11G PS5
    Thanks

    codigoadf wrote:
    the problem is in Javascript. remove "fvalue : comp.getSubmittedValue()" and will work fine.
    AdfCustomEvent.queue(comp, "ImageEvent",{ },false);comp.getSubmittedValue()?? comp is a imageAhhh yeah..I just copy pasted this code from google..
    Thanks for your help...it now works..

  • Advice to implement a mouse listener for card game

    Hi,
    I am wondering about the best way to apply a mouselistener in my card game.
    - i only want to listen for 'clicks'
    - I have a JFrame with a JPanel inside. The JPanel has a null layout and many JLabels. The JLabels are the cards, i want to listen for mouse clicks on these 'cards'
    I have seen it is not possible to apply a mouse listener to a JPanel or JLabel so is the most efficient way to apply the listener to the JFrame and then use getComponent () to determine which JLabel has been clicked ? or is there a better way ?
    any thoughts appreciated . .

    hey dubai, thanks for your quick help today, it is much appreciated !
    i know the event should provide a reference to the source, i use the toString to overide the methods in the mouseEvent object and im printing this string to the console. It gives me the correct dimensions within my JPanel of where i clicked but the source is always given as the panel name. Have you any idea why it does not return the name of the JLabel ? I checked out the Action interface, thanks, it cud be very useful to seperate the code by using this.

  • Click Event on ALV using cl_gui_alv_grid (DYNPRO)

    How can I implement a listener for a click on ALV.
    If I click on my ALV grid, for example PBA should be triggered. Is that possible?
    Now it seems that nothing happens when I click on ALV.
    Can anyone help?

    Hi Ezachiael,
    you dont have to trigger event DOUBLE_CLICK, it will be triggered, in case of double click :-).
    You have to implent event handling class and event handler method - It is quite simple.
    Check out this [Reference on SDN|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907].
    Regards
    REA

  • Is it possible to add a click event on an specific area of a larger png?

    Is there a way to code certain regions of an image for a click event without adding a hit area?
    I have a map of Texas with each region. Clicking on a region brings this region bigger to the front. Then I want a click event for each county to bring up its name and other data.

    Hello,
    Here is my experience: i tested canvas and area tags.
    Some tests: attachments.
    More about area tag.

  • Right Click Event C#

    Hi,
    Is it the right way to use the right click event to delete row in Matrix?
    Could you please give me the template method for right click event?
    Thank you,
    Rune

    private void m_Application_EventRightClick(ref SAPbouiCOM.ContextMenuInfo oContextMenuInfo, out bool BubbleEvent)
                BubbleEvent = true;
                string vm_Column_ID_string = oContextMenuInfo.ColUID;
                string vm_EventType_string = Convert.ToString(oContextMenuInfo.EventType);
                string vm_Form_ID_string = oContextMenuInfo.FormUID;
                string vm_Item_ID_string = oContextMenuInfo.ItemUID;
                Int32 vm_Row_Int32 = oContextMenuInfo.Row;

  • Problem listening for a customevent question

    I'm new to WLP and trying to setup a portlet to listen for a custom event.
    I'm using WLP 10.3.2 with two portlets on a page. Portlet 'A' fires a custom event when it is maximized. I verified the event is getting fired. Portlet 'B' is listening for my 'TestEvent' and should display a message if it receives the event. However portlet 'B' never receives the event. Portlet 'B' is a JSP portlet. Below is the code used to fire the event from portlet 'A', and the code from the 'B' portlet .portlet file. Can anyone tell me why portlet 'B' does not receive the event?
    thanks
    PORTLET A CODE TO FIRE EVENT:
    public void fireTestEvent(HttpServletRequest request,
                   HttpServletResponse response, Event event) {
              System.out.println("prepairing to fireTestEvent");
              PortletBackingContext context = PortletBackingContext.getPortletBackingContext(request);     
              context.fireCustomEvent("TestEvent", "test message");
              System.out.println("fired TestEvent");          
    PORTLET B CODE FROM .portlet file
    <?xml version="1.0" encoding="UTF-8"?>
    <portal:root xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0"
    xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0 portal-support-1_0_0.xsd">
    <netuix:portlet backingFile="backing.Listening" definitionLabel="bPortlet" title="Bportlet">
    <netuix:handlePortalEvent event="onMinimize" eventLabel="handlePortalEvent1"
    fromSelfInstanceOnly="false" onlyIfDisplayed="true" sourceDefinitionLabels="aPortlet">
    <netuix:invokeBackingFileMethod method="handlePortalEvent"/>
    </netuix:handlePortalEvent>
    <netuix:handleCustomEvent event="TestEvent" eventLabel="handleCustomEvent1"
    fromSelfInstanceOnly="false" onlyIfDisplayed="true" sourceDefinitionLabels="aPortlet">
    <netuix:invokeBackingFileMethod method="handleTestEvent"/>
    </netuix:handleCustomEvent>
    <netuix:titlebar>
    <netuix:maximize/>
    <netuix:minimize/>
    </netuix:titlebar>
    <netuix:content>
    <netuix:jspContent contentUri="/portlets/bPortlet.jsp"/>
    </netuix:content>
    </netuix:portlet>
    </portal:root>

    I figured out the issue. Portlet B only listens for the event if it is visible. The event gets fired when portlet A is maximized, so portlet B is no longer visible.
    thanks

  • Update screen on cl_gui_container_bar_xt "clicked" event

    I have a list of buttons in a cl_gui_container_bar_xt object (like the SE80 navigation bar on the left) - I have set up event listiners for the "clicked" event and it works great except for changing screen field values.
    What I need to do is change a screen element when one of these buttons is clicked.
    EG: - I want to change the screen field E070-TRKORR to blank if a button is clicked. Problem is that PAI or PBO are not fired, and it wont work within the event handler...
    My understanding is that the cl_gui_container_bar_xt object uses CL_GUI_TOOLBAR within it for the buttons, so it should work the same, but it's not...?
    Any ideas?

    I have a list of buttons in a cl_gui_container_bar_xt object (like the SE80 navigation bar on the left) - I have set up event listiners for the "clicked" event and it works great except for changing screen field values.
    What I need to do is change a screen element when one of these buttons is clicked.
    EG: - I want to change the screen field E070-TRKORR to blank if a button is clicked. Problem is that PAI or PBO are not fired, and it wont work within the event handler...
    My understanding is that the cl_gui_container_bar_xt object uses CL_GUI_TOOLBAR within it for the buttons, so it should work the same, but it's not...?
    Any ideas?

Maybe you are looking for

  • Spark skins, modules and custom themes: linking issues?

    I've read some other threads on this topic that were related to the pre-release versions, but I can't get a complete answer get. I also opened an issue in the bug tracker (https://bugs.adobe.com/jira/browse/SDK-30748), but I'm also posting here, hopi

  • Unused fonts in generated report

    Hi, My file turned out too large, so I generated a report and found two fonts that I'm no longer using in the file. How can I take these out of the file? Thanks. Dan

  • How do I put raw images into smart collections?

    I have just created some smart collections, however the CR files were rejected.  Is there a way to include them?  I shoot raw/jpeg, so would like both formats in the collection. Thanks.

  • Random Questions crash

    Hi I'm trying to use the Random Questions in Captivate3 using built up pools of questions, every time I try to preview the project it loads 25% and stays there for ever (hold the project). Has any one come across a solution to this problem? Thanks An

  • An Exception Occured when refershing the query

    Hello All, Below exception occured for the following two scenarios. It occured when i tried to refresh the query. Other Case, exception occured when i enter the user prompts , it was about to refresh and got the same error messageNeed to know, when t