![]() |
|
JRuby System Tray Balloon example - Printable Version +- (wL) Forums (https://war-lords.net/forum) +-- Forum: Resources (https://war-lords.net/forum/forum-31.html) +--- Forum: Programming (https://war-lords.net/forum/forum-33.html) +--- Thread: JRuby System Tray Balloon example (/thread-4490.html) |
JRuby System Tray Balloon example - naive - Oct 18 2011 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
RE: JRuby System Tray Balloon example - Dre@m$ - Oct 19 2011 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) |