Results 1 to 6 of 6
  1. #1
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,374
    Blog Entries
    1
    Rep Power
    18

    Wink [SOLVED] Baloon message on a tray icon

    Hi all,

    How can I add a balloon message into a tray icon, without using a action listener.

    Thanks

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,374
    Blog Entries
    1
    Rep Power
    18

  3. #3
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    7

    Default

    Hey Eranga... Can you post the solution here please? I'd like to know this one myself. Thanks
    Did this post help you? Please me! :cool:

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,374
    Blog Entries
    1
    Rep Power
    18

    Default

    Sure, nothing to do much pal. Define a public trayicon variable. Then in the displayMessage() method check all the arguments are available or not.

    Java Code:
        private void statusMessage(){
            try{
                trayIcon.displayMessage("Message Title", 
                "Message Content",
                TrayIcon.MessageType.INFO);
            }
            catch(NullPointerException npe){
                System.out.println(npe.getLocalizedMessage());
            }
        }
    This is only the code I used. Called it in an appropriate place of your application. I've add it just after the tray icon added to the system tray.

  5. #5
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    7

    Default

    Nice one. Sure ill be using it in the future.
    Did this post help you? Please me! :cool:

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,374
    Blog Entries
    1
    Rep Power
    18

    Default

    Why not. Easiest way, and the most perfect way I think :)

    Only logic is make to happened something essential to JVM. Like exception handling.

Similar Threads

  1. Minimize to System Tray In Windows
    By shapeshifter in forum AWT / Swing
    Replies: 4
    Last Post: 12-07-2008, 01:42 PM
  2. Icon initialization problem
    By saz25 in forum AWT / Swing
    Replies: 1
    Last Post: 12-24-2007, 10:37 PM
  3. Custom icon for Frame
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-21-2007, 08:38 AM
  4. How to set an Icon in a Label?
    By Soda in forum New To Java
    Replies: 2
    Last Post: 12-07-2007, 12:38 PM
  5. To add an icon to my project
    By Albert in forum AWT / Swing
    Replies: 1
    Last Post: 07-13-2007, 03:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •