How to display a tray message when the program is just minimized to tray?

hello there
i made my program is minimized to tray when pressing the standard close button using the new features of Java SE 6 system tray
but i want to display a tray message when the program is just minimized to tray(when pressing the standard close button)
like in MSN Messenger to alarm the user that the progam is still running here,any ideas?
i tried
WindowAdapter actionListener2 = new  WindowAdapter()
                public void windowClosing(WindowEvent e2) {
                try{
Thread.sleep(1);
  trayIcon.displayMessage("Take Care !",
                "JShutdown Timer Is In Progress Here.",
                TrayIcon.MessageType.WARNING);
       catch(InterruptedException un){}
            };isn't that right?
any one could help?

Try to debug your code first with simple System.out.println statements to see if your method from adapter class WindowAdapter is called at all, I don't understand you fully and I don't understand you code but you can simply add WindowListener to the thing you are closing (like JFrame) with
this.addWindowListener(new WindowAdapter(){
            public void windowClosing(WindowEvent e){
                //to do - when JFrame is closing!
        });The "this" is the reference to your Window/Frame, inside the overriden method you can invoke the operations on the system tray instance, like display message etc.
Hope this helps!

Similar Messages

  • Error in sql server with a trigger (I want to display a customize message, when the user left a blank field or null) How can I do?

    How I display a customize message(with a trigger)when a user left a blank field? I want to the stop the insert statament if the user left  the status field in blank. I create a trigger but now I can't enter a row, i used an instead trigger
    too but doesn't work. I want to display a customize message when the user left the
    status field in blank or null. 
     I have the following code:
    CREATE TRIGGER [dbo].[BLANKFIELD] 
    ON [dbo].[Status] 
    FOR INSERT 
    AS 
    BEGIN 
    IF (SELECT COUNT(*) FROM inserted WHERE Status IS NULL) =1
     PRINT 'Please Fill the Status  field is required'
    Rollback;
    END 

    I agree with other comments that you should do this with specifying that the column is NOT NULL to prevent it from being NULL and a constraint if you don't want it to be blank (spaces or the empty string - note that the empty string is not the same thing
    as NULL).
    But for completeness, the reason your trigger does not ever allow you to enter a row is the code
    IF (SELECT COUNT(*) FROM inserted WHERE Status IS NULL) =1
    PRINT 'Please Fill the Status field is required'
    Rollback;
    Since you don't have a begin/end block after IF, the only conditionally executed statement is the one immediately following the IF (that is the PRINT).  So the Rollback is always executed whether or not the IF is true and so all updates are rejected.
    So if you were to do this in a trigger you could do something like the following
    CREATE TRIGGER [dbo].[BLANKFIELD]
    ON [dbo].[Status]
    FOR INSERT
    AS
    BEGIN
    IF EXISTS(SELECT * FROM inserted WHERE Status IS NULL)
    BEGIN
    PRINT 'Please Fill the Status field is required';
    Rollback;
    END
    END
    (As José noted, there can be more than one row in the inserted pseudo table, so you don't want to test whether the COUNT = 1, instead just whether one or more rows exist where the Status  is null.  If you want to prevent Status is NULL, or all
    spaces, or the empty string, then your IF statement would be
    IF EXISTS(SELECT * FROM inserted WHERE ISNULL(Status, '') = '')
    Tom

  • How to display all validator messages at the same time?

    Hi Guys,
    I have a form with validators attached to a couple of my input boxes. I tried to write validators which are reusable in other parts of my app ie. social security number check etc. I also then customized the messages and it all works fine.
    But when I submit the form it displays the messages one at a time, in other words every validator is performed and if there was an error the form is rendered. I believe this is how it should behave and that's fine.
    But what if I want all validators to be performed when I submit the form?Then all messages are displayed at the top of the page and the user can make all his changes and try again. This makes more sense to me.
    So my question is whether there is a way to force the page to perform all validators when the page is submitted and then display all error messages in a h:messages tag?
    Cheers and thanks alot
    p.s. i know about and use the hidden input field validator hack which does all validations, but if I do it that way I duplicate the code which does the social security check for all applicable forms.

    Strange, I was under the impression that all validators were run by default. In my JSF apps, all the validators run and output their errors without any special confguration to make this happen.
    I wonder why yours are just running one at a time? Could you show some of your JSP code, and the hidden field validator code?
    CowKing

  • How to display a confirmation message to the second stage approver.

    Hi,
    I am working on an application which involves 2 stages of serial approvals. After the first stage approval, the request is forwarded to the second stage. When the second stage approver approves the request, the workflow proceeds with the user creation. I would like to let the second stage approver know about the status of user creation after he clicks the approve button. It can be just a simple message saying that the user creation has been successful or unsuccessful.
    My question is how is it possible to show this confirmation message to the second stage approver after the user creation process?
    I tried to use manual action. But it is not working(probably because the owner of the workflow is different from the second stage approver). Is there any other way to implement this?
    thanks,
    manoj.

    It is really simple to implement, you have to just write another manual action to second supervisor after user creation and pass the result to manual action.
    Hoping you are tried to create simple user with out assigning so many resources otherwise it will take time to load.
    Please let me know if you face any issue to implement.

  • Web-based BEx: How to display a customized message on the variable screen??

    Hi All,
    I'm now using the web-based BEx. Recently I want to display a customized message (e.g. the usage of the report) on the first page (i.e. the variable entry screen) of the query. Is it possible?
    Thanks.
    BR,
    M. Ng

    Hi marco,
          Check here. itmay help you.
    Custom Messages WAD
    Thanks,
    Vijay.

  • How to display custom error message if the Required field is not entered?

    Hi,
    I have made one input field as required field in a view.
    I want to display one custom error message ,if the required input field is not entered.
    Please help me regarding this.
    Thanks,
    Deepika

    hi deepika....
    First go to message pool under webdynpro components.
    Create a new message there..of type error.
    Enter your text.
    Now to avoid null pointer exception , in wdDoInit(), initialise the value
    wdContext.currentDateTimeElement().setDate("");
    now create an action for submission of data. If field is empty, then within the button write:
      msg = wdComponentAPI.getComponent().getMessageManager();
        if(wdContext.currentDateTimeElement().getDate().equals(""))
        msg.raiseMessage(IMessageCompTodatDateTime.ERROR,new Object[]{""},true)     ;
    between begin others put:
    regards,
    pinki
      IWDMessageManager msg = null;

  • How to display group data only when the particular group is clicked

    Hi frnds,
    I want to design my report as follows:
    Data is grouped by country, and for each country it is showing details for that country. I need to find out a way to display all group names first.  E.g.
    Argentina
    Aruba
    Australia
    And on click of particular country name it should display its details below it
    e.g.
    -Argentina
         BBB            Mendoza          123456
    +Aruba
    +Australia
    Has anyone done that before??? Is it possible to achieve it through Crystal Report Designer (2008)?? If yes then how???
    A prompt reply would be appriciated as i need this information urgently.
    Thanx.

    Thanx Jehanzeb,
    The sample u suggested did not solve my problem since it is opening the group data in new window.
    My question is - can we show/hide group data by clicking on that particular group (under that group name).
    e.g.
    ->(initial display - only groups)
    + Australia
    + America
    + Bhutan
    ->(on clicking a group)
    + Australia
    \- America
    abc    xyx    12213213    wqe9090
    dsd    dcv     90eur90e    ifjjdioifdoi
    + Bhutan
    In short, I am looking for on-demand display of records grouped by some field and the expansion of data must be done in the same page.
    Edited by: Kuldeep Chitrakar on Aug 6, 2008 12:44 PM
    Edited by: Kuldeep Chitrakar on Aug 6, 2008 12:45 PM
    Edited by: Kuldeep Chitrakar on Aug 6, 2008 12:46 PM

  • How do I print a .pdf, when the program only gives me an option to save?

    I have read all the previous answers to this question. They all suggest to uncheck the print to
    file checkbox in the print dialog box. However, it appears I do not have a 'print to file' checkbox
    in my print dialog box. Any new ideas?

    you should install a PDF printer program and when you install a PDF printer program, it sets up as a printer in your computer's printer folder. (You won't see any application to run).
    All you need to do is print your document as you normally would, and choose the PDF program as the printer you want to use. The file it creates can be named whatever the original document name was named, but it will have .pdf extension instead. Very easy, very helpful.

  • How to display an error message in maintenace view

    Hi,
    I have following requirement.
    I have a table. In the table, there is a field named REPORT which keeps an executable report name. When adding an entry i need to fill the field with an report name, which should exist in the system. The report name should not be include objects.
    Then I use search help HELP_TRDIR with import parameter SUBC = 1.  I also create a maintenance view for the table.
    Then my question is how to display a warning message if the report I input in REPORT field doesn't exist in the system. If I need to modify the generated objects of the maintenance view, how to do it.
    The reason i don't use foreign key is that it seems filter functionality is not availabe in the case with import parameter SUBC = 1.
    Thanks in advance,
    Best Regards, Johnney.

    Hi,
    You need to add your validation in the table maintenance events:
    Use the event : 01 - Before saving data to the databse table... for this purpose
    1) Go to Menu-> Utilities->Table mainatenace generator
    2) On the table maintenance screen->Menu->Enviroement-> Modifications->Events
    3) select an event 01 and give some subroutine/form name.
    4) Add your validation in the form(Note this form should be in the Func Group of the table maintanance genetaor)
    Regarrds
    Shiva

  • How do i get my navbar to stay on one line when the browser window is minimized?

    I am new to coding and have just created my first website in html and css.  I know that the coding is pretty dire and that I have a lot to learn and hope that someone can guide me in how to solve this problem.  When the browser window is minimized, the navbar breaks down into 2 or 3 lines but I want the navbar to fit to the window whatever the size of the client machine.
    I think I need to add a media query but i'm not sure if i do and if so what code to use and where to put it?
    I am worried that the page will only be viewable properly on a desktop and i really want to learn how to make a fluid layout which can be viewed on 320px, 768px and 1200px.
    Any guidance would be greatly appreciated.
    Here is my code:
    HTML
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>The Engineer's Corset</title>
    <link href="styles/style.css" rel="stylesheet" type="text/css" media="screen">
    <style type="text/css">
    body {
        background-color: #000;
    </style>
    </head>
    <body>
    <div id="container">
    <div id="navbar">
        <ul id="nav">
        <li><span class="current-menu-item">Home</span></li>
        <li><a href="about.html">About Us</a></li>
        <li><a href="workshops.html">Workshops</a></li>
        <li><a href="news.html">News</a></li>
        <li><a href="gallery.html">Gallery</a></li>
        <li><a href="contact.html">Contact Us</a></li>
        </ul>
    </div>
    <div id="header">
      <img src="images/final/headerbeauty3.png" width="1100" height="341" alt="The Engineer's Corset">
    </div>
    <div id="links">
    <ul id="link">
    <li><a href="https://www.facebook.com/Bristolengineer" target="_blank"><img src="images/final/fb3.png" width="200" height="45" alt="Follow Us on Facebook"></li>
    <li><a href="https://twitter.com/Engineerscorset" target="_blank"><img src="images/final/twitter2.jpg" width="200" height="45" alt="Follow us on Twitter"></a></li>
    </ul>
    </div>
    <div class="chantry">
    <img src="images/final/CD Logo fin.png" width="240" height="200" alt="Chantry Dance Company">
    </div>
    <div class="about">
      <p> The Engineer's Corset is a new play written by Janet Goddard for performance by the community of Bristol in 2015. <br>  ~ <br>
    The play is based on the extraordinary real-life events of 1843 surrounding Isambard Kingdom Brunel's near-death experience after swallowing a coin.  We travel through time to explore the adventure and horror of Victorian industrialisation. <br> ~ <br> Using a community theatre group The Engineer’s Corset tells a familiar tale of Brunel’s near death experience when he swallows a gold half sovereign. His wife Mary fights to maintain her composure but is ripped apart by the waiting game. Her servants and his workforce, using dance and sound, broaden her horizons. Just like Mary the audience too will see life in the 1840s through a different lens.</p>
    </div>
    <div class="workshops">
    <img src="images/final/bridgebridge.jpg" width="1100" height="713" alt="clifton suspension bridge">
    <span><a href="workshops.html">We will be running a series of workshops prior to production and hope you will join us.  For further information, click here.</a></span>
    </div>
    <div id="sponsorspace"></div>
    <div id="footer"> <p> &copy; Heartprints Web Design 2014 </p> </div>
    </div>
    </body>
    </html>
    CSS
    @charset "utf-8";
    /* CSS Document */
    body {
        font-family:Arial, Helvetica, sans-serif;
        font-size:125%;
    @media screen {
        #navbar:
    #navbar li {
        font: 25px Arial;
        display: inline;
        list-style-type: none;
        background: #09F;
        color: #000;
        border-radius: 20px;
        padding: 15px 25px;
    .current-menu-item {
        color: #0FF;
    #navbar a {
        padding: 15px 25px;
        background-color: #6cf;
        color: #000;
        text-decoration: none;
        border-radius: 20px;
    #navbar a:hover {
        background-color:#0FF;
        color: #000;
        padding: 15px 25px;
    #header {
        width: 1100px;
        height: 340px;
        margin-left: 50px;
        margin-top: 0px;
        margin-bottom: 0px;
        border-style: ridge;
        border-width: 5px;
        border-color:#09F;
    #links li {
        display: inline;
        width: 700px;
        margin-left: 300px;
    .chantry {
        margin-left: 40px;
    .about {
        position: relative;
        width: 860px;
        text-align:center;
        background-color: #CCC;
        color: #000;
        border-style: ridge;
        border-width: 3px;
        border-color:#09F;
        border-radius: 15px;
        float: right;
        margin-top: -200px;
        margin-right: 90px;
    .workshops{
        position:relative;
        width: 1100px;
        height: 713px;
        font-size:24px;
        margin-left: 50px;
        border-style: ridge;
        border-width: 5px;
        border-color:#09F;
        margin-top: 130px;
    .workshops span {
        position: absolute;
        background: #6CF;
        color: #000;
        left: 30px;
        top: 30px;
        right: 800px;
        padding: 15px;
        font: 1em georgia, serif;
        font-style:italic;
        text-align:center;
        border: 5px solid #09F;
        border-radius: 20px;
        margin-top: 35px;
    .workshops span a {
        color: #000;
    #link li {
        border-style: solid;
        border-color: #6CF;
        padding: 30px 10px 5px 10px;
    .info {
        text-align:center;
        width: 1100px;
        margin-top: 50px;
        margin-bottom: 50px;
    .CDC {
        float: left;
        margin-right: 50px;
        margin-left: 45px;
    .workshopinfo {
        height: 250px;
        text-align:center;
        margin-top: 50px;
    .photos {
        Height: 500px;
        text-align:center;
        margin-top: 50px;
    #footer {
        text-align:center;
        margin-top: 700px;
        color:#0CF;
    .brunel {
        margin-top: 50px;
        margin-left: 400px;
    #workshops2{
        width: 1000px;
        border-style: outset;
        border-width: 5px;
        padding: 15px;
        border-color:#09F;
        background-color: #6CF;
        margin-left: 100px;
        text-align:center;
    #workshops2 a {
        color: #000;
    #sponsorspace {
        height:  300px;
        background-color: #6CF;
        border-style: outset;
        border-color: #09f;
        margin-top: 15px;

    Give #navbar a width that is wide enough to hold all of the buttons within it.
    #navbar {
         width:####px;
    Replace #### with a pixel number large enough to hold the nav buttons.

  • How to display an error message after validation in Formatted Search?

    Hi SBO experts,
    if an error is detected on validation in a Formatted Search, how to display an error message to the user entering the data?
    Thanks & Regards,
    Raghu Iyer

    i created a formatted search query & attached it to the field 'Quantity' at Line Item level in Sales Order screen. just for testing purpose, i eneterd the following code lines in the query validating 'Quantity'
    if $[$38.11.0] > 50
    begin
    select @error = 1
    select @error_message = 'Vendor code cannot begin to X sign.'
    end
    the system throws the error : Internal error (8180) occurred [Message 131-183]
    actually, i need to display an error message to the user if Quantity is not in multiples of the OITM.SalFactor2
    if $[$38.11.0] % (SELECT T0.[SalFactor2] FROM OITM T0 WHERE T0.[ItemCode]  = $[$38.1.0]) > 0
    begin
    select @error = 1
    select @error_message = 'Error in Quantity.'
    end
    but, this expression to get the remainder itself seems to have some error
    $[$38.11.0] % (SELECT T0.[SalFactor2] FROM OITM T0 WHERE T0.[ItemCode]  = $[$38.1.0])
    i guess, % operator is used for modulo (to find the remainder of one number divided by another.) ? am i right ?
    Regards,
    Raghu Iyer

  • How to display an error message on screen?

    Hi experts,
    In screen painter, how to display an error message in the message area just below the screen?
    Thanks!

    hi wuyia,.
    Write like this;
    Message 'Process completed Successfuly' TYPE 'S'.
    Message 'Want to Overwrite Value' TYPE 'W'.
    Message 'Press enter to continue' TYPE 'I'.
    Message 'Invalid Input' TYPE 'E'.
    S - Success
    W - Warning
    I - Information
    E - Error
    You can adjust your GUI option to display the message in a Popup or in the status bar.
    Regards
    Karthik D

  • TS1456 My 4th Gen iPod Nano isn't displaying a "Use iTunes to restore" message, but iTunes is displaying a restore message when I connect it. I have original music that I can't back up on my iPod. Is there any way that I can fix the iPod without restoring

    My 4th Gen iPod Nano isn't displaying a "Use iTunes to restore" message, but iTunes is displaying a restore message when I connect it. I have original music that I can't back up on my iPod. Is there any way that I can fix the iPod without restoring it?

    It's not designed to work like this. When you sync, the iPod stores some information that basically says 'this iPod belongs to computer xyz'. Apple did this to prevent copyright issues (syncing someone else's music).
    If you really want to do this, you'll have to at least tie both iTunes installations to the same account. Maybe have them sync with each other.

  • How do I save "Sent" messages when sending from the ipad

    How do I save "Sent" messages when sending from the ipad2?

    By default sent items should be saved in your Sent folder. For IMAP type accounts you should be able to change that by selecting the account in Settings > Mail, Contacts, Calendars , then selecting 'Account' on the popup for it and then 'Advanced' at the bottom of the next popup

  • How to show/print waiting message when system is serving pdf to browser

    Hi,
    does anybody know how to print/show "please wait for your request to be completed..." message when they try to click GeneratePdf button for example
    they way i do serving pdf to the browser is as below
    response.reset();
    response.setContentLength(contentLength);
    response.setContentType("application/pdf");
    response.setHeader("Content-disposition", "inline; filename=\""System.currentTimeMillis()+".pdf"+ "\"");
    output = new BufferedOutputStream(response.getOutputStream());
    while (contentLength-- > 0) {
    output.write(input.read());
    output.flush();and this is what was written in my popup jsp ( when user click GeneratePdf , the application will process it and at the end serve pdf file to the user using popup window )
    <body> <h1>Please Wait for your request to be completed...........</h1> </body> </html>
    <%
    boolean redirect=false;
    try{
    PdfDispatcher.dispatchApplication(response,session);
    }catch(Throwable t){
    System.out.println("Application Dispatcher Exception ... "+t.getMessage());
    System.out.println("Continue as per normal....");
    redirect = true; // will redirect to other jsp output
    if(redirect){
    //go to other jsp
    }The problem is my message above never got printed to the page ( i guess because the browser thinks that the response has not been completed )
    by the time the response has been completed the whole page will be cover in pdf document
    The reason i want to do this because my user complaining that they see blank page for long time when the system is slow to generate/server pdf to them.
    and it would be better to show some "waiting message" when the system is processing the application and server pdf at the end of the operations.
    anybody know how to workaround this?
    Thanks

    just_a_kid83 wrote:
    does anybody know how to print/show "please wait for your request to be completed..." message when they try to click GeneratePdf button for exampleUse JavaScript+DOM. Add a <div> somewhere in the page where the message should be displayed and put the message and an animated 'loading' gif in it. Hide the <div> using the CSS 'display' property which is set to 'none'. Then add an onclick event to the button/link which downloads the PDF file which gets the <div> element by its ID and set its 'display' property to 'block'.

Maybe you are looking for