Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
JRuby System Tray Balloon example
#1
Here is a little JRuby system tray example for you. It will pop up a notifier balloon from the system tray.

Code:
include Java

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

if (java.awt.SystemTray::isSupported())

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

  popup = java.awt.PopupMenu.new
  exititem = java.awt.MenuItem.new("Exit")
  exititem.addActionListener {java.lang.System::exit(0)}

  oraitem = java.awt.MenuItem.new("Go To WL")
  oraitem.addActionListener do
    java.awt.Desktop::desktop.browse(java.net.URI.new("http://www.war-lords.net"))
  end

  popup.add(exititem)
  popup.add(oraitem)
  trayIcon = TrayIcon.new(image, "Tray Demo", popup)
  trayIcon.image_auto_size = true

   trayIcon.addMouseListener() do |method|
    puts "mouse event #{method.to_s}"
  end

  tray.add(trayIcon)
   
  trayIcon.displayMessage("Message","Hi!", TrayIcon::MessageType::INFO)
end
 
"Most people think time is like a river, that flows swift and sure in one direction. But I have seen the face of time, and I can tell you, they are wrong. Time is an ocean in a storm."
#2
Thank you! i going to add this to my Proxy Tran(gets Proxies for sites and puts them in a tester and then in to any thing your using(pK,kry,DDoS system 8) .etc)I use most for meh Runescape bots and Minecraft bots)
~The lonely Stoner seems to free his mind at night~

Users browsing this thread: 1 Guest(s)