Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9012739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:05:00+00:00 2026-06-16T03:05:00+00:00

Currently in my (JRuby code), I want to handle balloon close messages differently than

  • 0

Currently in my (JRuby code), I want to handle “balloon close” messages differently than “double click on the tray icon” (awt.TrayIcon instance):

import java.awt.TrayIcon
import java.awt.event.MouseListener

tray = java.awt.SystemTray::system_tray
image = java.awt.Toolkit::default_toolkit.get_image('')

trayIcon = TrayIcon.new(image, 'name', nil)

tray.add(trayIcon)
trayIcon.addActionListener do |evt|
  puts "in here", evt.id
end
trayIcon.displayMessage("title", "try clicking within the baloon, but not the x, then double clicking the tray icon", TrayIcon::MessageType::INFO)
puts "try clicking within the balloon message, or double clicking, both seem to generate the same event"

and the equivalent code in java https://gist.github.com/4338167

it seems that this action listener gets called either when 1) a user double clicks the icon in the system tray, or 2) a user closes a tray’s recent balloon message by clicking on the balloon (not on the x).

Is it possible to distinguish between the 2 different event types (both seem to have event id 1001), or must I just infer it by timing relative or something else? Or can I somehow “know” that the balloon is still up, and thus the click must have come from it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:05:01+00:00Added an answer on June 16, 2026 at 3:05 am

    The documentation for TrayIcon seems to imply that clicking on the balloon message can trigger an ActionEvent, which is the same as, for your case, double-clicking on the icon itself.

    You may need to add a mouse listener to trigger on clicks, and if a click event is followed by an ActionEvent within some small period then it’s a double-click, otherwise it’s a click on the message being displayed. By choosing a sufficiently small interval, you should be able to properly distinguish them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I followed all of the instructions so far from: http://code.google.com/p/appengine-jruby/wiki/RunningRails and http://gist.github.com/268192 Currently, I'm
I'm currently porting my jruby/java2d Graph Drawing/Layouting application to macruby/cocoa. Therefore I need to
Currently working with converting SQLException error messages into messages that are more useful for
Currently I have this code: <?php echo '<meta name=robots content=noindex>'; $arr = json_decode(file_get_contents(http://media1.clubpenguin.com/play/en/web_service/game_configs/ paper_items.json),true);
is there any way to make my currently jruby script into a standalone single
I want to export some data from my jruby on rails webapp to excel,
I am using jruby-1.6.6 with rails 3.2 currently. And I am using gem 'bootstrap-sass',
Currently with swt, I sometimes want a program to arbitrarily come to the foreground
I currently run my Rails app using: jruby --1.9 -J-XX:+CMSClassUnloadingEnabled -J-XX:+UseConcMarkSweepGC -J-XX:MaxPermSize=256m -S rails
Currently, I am writing a MiddleWare application that synchronizes information between and accounting application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.