How it can't show Dialog? mailbox

Hi everyone:
I find some code which monitor the mailbox.When there is an new mail it will show a dialog to modify user.I setup a mail server "Argosoft" and startup IMAP service.
When I send a mail the mail server will log the information.But the application don't show any dialog?! I run it type: java Monitor localhost [email protected] password
What's wrong with it? The console print no message . Help!
The code is:
public class Monitor  {
     private boolean stay = true;
     Point point;
     public Monitor(String[] params)  throws NoSuchProviderException,MessagingException  {
          point = new Point(0,0);
          Properties props = System.getProperties();
          Session session = Session.getDefaultInstance(props, null);
          Store store = session.getStore("imap");
          store.connect(params[0],params[1],params[2]);
          Folder inbox = store.getFolder("INBOX");
          if (inbox == null || !inbox.exists()) {
               System.out.println("Invalid folder");
               System.exit(1);
          inbox.open(Folder.READ_ONLY);
          inbox.addMessageCountListener(new MessageCountListener() {
               public void messagesAdded(MessageCountEvent ev) {
                    Message[] msgs = ev.getMessages();
                    if(msgs.length == 1) {
                         try {
                              Message message = msgs[0];
                              String subj = message.getSubject();
                              InternetAddress[] adds = (InternetAddress[]) message.getFrom();
                              showDialog("<HTML><TABLE><TR><TD>From:</TD><TD>"+adds[0].getPersonal()+"</TD></TR><TR><TD>Subject:</TD><TD> "+subj+"</TD></TR></TABLE></HTML>");
                         catch(MessagingException ex) {
                              ex.printStackTrace();
                              stay = false;
                    else {
                         showDialog("<HTML>Recieved " + msgs.length + " email messages.</HTML>");
               public void messagesRemoved(MessageCountEvent ev) {}
          while(stay) {
               inbox.getMessageCount();
               try {
                    Thread.sleep(5000);
               catch(InterruptedException ex) {}
          inbox.close(true);
     private void showDialog(String msg) {
          final JDialog dialog = new JDialog((JFrame) null,"Email Received");
          ImageIcon icon = new ImageIcon(getClass().getClassLoader().getResource("icons/Information24.gif"));
          JLabel label = new JLabel(msg,icon,SwingConstants.LEFT);
          dialog.getContentPane().setLayout(new BorderLayout());
          dialog.getContentPane().add(label,BorderLayout.CENTER);
          JPanel panel = new JPanel();
          JButton button = new JButton("Close");
          button.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent ev) {
                    point = dialog.getLocation();
                    dialog.dispose();
          panel.add(button);
          button = new JButton("Stop");
          button.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent ev) {
                    stay = false;
                    dialog.dispose();
          panel.add(button);
          dialog.getContentPane().add(panel,BorderLayout.SOUTH);
          dialog.pack();
          dialog.setVisible(true);
          dialog.setLocation(point);
          dialog.toFront();
     public static void main(String[] argv) {
          if(argv.length != 3) {
               System.out.println("Usage: Monitor <host> <user> <password>");
               System.exit(1);
          try {
               new Monitor(argv);
          catch(Exception ex) {
               ex.printStackTrace();
               System.exit(1);

Hi
I change the code to final JDialog dialog = new JDialog( );
dialog.setTitle( "Email Received" );
But it can't work too.the code is:
     public void messagesAdded(MessageCountEvent ev) {
                    Message[] msgs = ev.getMessages();
                    if(msgs.length == 1) {
                         try {
                              Message message = msgs[0];
                              String subj = message.getSubject();
                              System.out.println("Receive from:"+message.getSubject());
                              InternetAddress[] adds = (InternetAddress[]) message.getFrom();
                         }There is not any message print on the console : ( My email server is running well and IMAP is opened.
Why it couldn't monitor it?

Similar Messages

  • How we can make CQ dialog box movable on page like sidestick?

    Hello All,
    How we can make CQ dialog box movable on page like sidestick.
    Should we have to use any property for that.
    Please tell me if any onw know this ticks.
    Thanks a ton in advance...
    Regards,
    Satish

    You could use dialogMode property configured under cq:editConfig node.
    dialogMode : floating
    http://dev.day.com/docs/en/cq/current/developing/components.html
    This should make your component dialog float and be movable.
    - Ashish

  • How to open and show dialog "Save" in jsp

    Hi all,
    I write a program which open and show all file type. If browser can open -> open and show this file, if can not open, the program must show dialog "Save". How I can check browser can open a file ?
    Thanks

    How I can check browser can open a file ?You cannot.
    You can decide to let the client choose the option to save or open the file itself. Change the "content-disposition" in the header to "attachment". Then the client will always get a "Save as" dialogue.

  • How we can Open dialog box in form 6i

    Hi
    How we can use file Dialog Box (Open Dialg,Save Dialog Etc) in forms 6i.
    Thanks & Regards

    Use GET_FILE_NAME built in
    ** Built-in: GET_FILE_NAME
    ** Example: Can get an image of type TIFF.
    DECLARE
    filename VARCHAR2(256)
    BEGIN
    filename := GET_FILE_NAME(File_Filter=> 'TIFF Files (*.tif)|*.tif|');
    READ_IMAGE_FILE(filename, 'TIFF', 'block5.imagefld);
    END;
    Rajesh Alex

  • Show in Mailbox missing from Smart Folders?

    If I create a search, either in Mail.app or via Spotlight, I get the "Show in Mailbox" hyperlink in the message viewer.
    If I then save this search as a Smart Folder and then view the same messages from within the Smart Folder, I no longer get the "Show in Mailbox" hyperlink.
    Irritating, as it would be very useful for viewing, say, flagged messages from a mailing list in context.
    Mail.app 3.5
    Bug, feature, I'm missing something obvious?
    Best wishes,
    Christopher

    Hi Christopher,
    Did you find out how to enable the "Show in Mailbox" hyperlink in the message viewer from within the Smart Folder? I also would find this feature really useful.
    Mail version is 3.5 (930.3).
    Thanks!
    Gaston

  • How can i show the dialog of certificates when tring to sign (like CAPICOM)

    Hi,
    I'm using "Windows-MY","SunMSCAPI" to choose a certificate from the keystore to sign a document.
    1) Can i show a dialog containing the certificates in the key store like in CAPICOM?
    2) To find a solution i 've found this code (CAPICOM + JAVA) her http://www.jensign.com/JavaScience/www/CertContext/CertContext.txt
    when i compile it, "com.ms.com" et "capicom" are missing ??
    Thank You in advance for any help

    nbbbn wrote:
    In the other words how can i call the *"certificate selection dialog box"* from source code?You can't " call the *"certificate selection dialog box"* from source code" as such. What one can do is iterate through the keys and certificates in the keystore and use the results to populate a dialog.
    The problem I have is that you seem to not want to go through the documentation. Most people here will assist when you have problems but they do like to see some effort. If you had read though the JCE tutorial and done a Google search then you would have found out how process the content of a keystore. If at this point you still had a problem then posting the problem code would likely to be profitable but ...
    Best of luck.

  • How can I make personalized mailboxes like work, personal stuff on the ipad

    How can I create a folder or personalized mailbox to the mail feature on the iPad...... I have my email with verizon.....there is nowhere to press a plus sign to create a folder or mailbox for work related emails, personal emails, expense emails or such.....can anyone help me!!!!

    You can only create additional mailboxes if your email account is an IMAP account. You tell this by tapping on your account in the mailboxes window -  and in the window that shows your inbox, sent folder, trash folder, etc - there will be an Edit button at the top of that window. If there is no edit button - you do not have an IMAP account and you can't create new mailboxes. If the Edit button is there - tap on it and the tap New Mailbox at the bottom of the window.

  • Suddenly I have problems moving files to the trash...  get a dialog saying Finder wants to make changes and I must provide the password... Any explanation or ideas how I can get this to stop?

    Suddenly I have problems moving files to the trash...  get a dialog saying Finder wants to make changes and I must provide the password... Any explanation or ideas how I can get this to stop?

    Please take these steps if you're prompted for a password when moving items in your home folder to the Trash.
    1. Triple-click anywhere in the line below on this page to select it:
    ~/.Trash
    2. Right-click or control-click the highlighted line and select
    Services ▹ Show Info
    from the contextual menu.* An Info dialog should open.
    3. The dialog should show "You can read and write" in the Sharing & Permissions section. If that's not what it shows, click the padlock icon in the lower right corner of the window and enter your password when prompted. Use the plus- and minus-sign buttons to give yourself Read & Write access and "everyone" No Access. Delete any other entries in the access list.
    4. In the General section, uncheck the box marked Locked if it's checked.
    5. From the action menu (gear icon) at the bottom of the dialog, select Apply to enclosed items and confirm.
    6. Close the Info window and test.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination command-C. Open a TextEdit window and paste into it (command-V). Select the line you just pasted and continue as above.

  • How can I show code here?

    Hello,
    Im new on this board. First off all:
    How can I show java code here (eg. by tag)?
    Thanks

    click the code button on the dialog then past your code between the tags.

  • I have gmail and hotmail account on my macbook. In gmail I can visualize all the mailboxes but in hotmail i only can see the inbox ¿how can I visualize the rest of the mailboxes? thanks

    I have gmail and hotmail account on my macbook.
    In gmail I can visualize all the mailboxes but in hotmail i only can see the inbox ¿how can I visualize the rest of the mailboxes?
    I have the same problem with my ipad; the solution would be the same?
    thanks

    Hello Sophie59
    You should be able to see two different tabs when setting up the email if you go to Other > Add Mail Account. Once you enter in the email address and password, you should be at the next screen to provide more details about the email as far as incoming and outgoing servers and at the top there will be a blue section to add it in as a POP or IMAP email account. Check out the article below for further troubleshooting and emails setup options.
    iOS: Troubleshooting Mail
    http://support.apple.com/kb/ts3899
    iOS: Adding an email account
    http://support.apple.com/kb/ht4810
    Regards,
    -Norm G.

  • How can we show data in rows when it is in Columns........

    I have strucked with a simple but a complex problem.
    I have a Report with data in vertical rows..need of the hour is how can we show that data into column structure.
    here is the table sample which i have in Database..
    Location      chrg_type    Effective_date
    xxxxxxx        xxxx          xx-xx
    thhis is the structure in effective date we have several months in it in a single column i want show the effective date or effective month in various columns instead of a single column.
    my required table is....
                                Effective_date     Effective_date
    Location      chrg_type     xx-xx              xx-xx
    xxxxxxx        xxxx          xx-xx
    any tough heads?????

    Hi Sunil,
    Your 1st problem is that you are going to need one more field to accomplish you goal. What type of data do want under your new date columns?
    Anyway, once you have that you need to move on to how to move the data out into columns based on date.
    Try something like this.
    0_Date = IF DATEPART('m',{tbl.Effective_date}) = DATEPART('m',CurrentDate) AND
    DATEPART('yyyy',{tbl.Effective_date}) = DATEPART('yyyy',CurrentDate)
    THEN {tbl.DataField}
    1_Date = IF DATEPART('m',{tbl.Effective_date}) = DATEPART('m',DATEADD('m', -1, CurrentDate)) AND
    DATEPART('yyyy',{tbl.Effective_date}) = DATEPART('yyyy',DATEADD('m', -1, CurrentDate))
    THEN {tbl.DataField}
    2_Date = IF DATEPART('m',{tbl.Effective_date}) = DATEPART('m',DATEADD('m', -2, CurrentDate)) AND
    DATEPART('yyyy',{tbl.Effective_date}) = DATEPART('yyyy',DATEADD('m', -2, CurrentDate))
    THEN {tbl.DataField}
    ... Repeat this process until you have all of the columns you need, following this format.
    Hope this works for you,
    Jason

  • Hi, I have purchased an audio book on iTunes from an iMac and it does not show up on the cloud so I can't download it on my iPhone. Does anyone know why and how I can proceed to transfer the audio book purchase?

    Hi
    I have purchased an audio book from iTunes with my iMac.
    Now I wanted to listen to it on my iPhone so I proceeded to transfer the purchase and looked for the book in the purchased section of the store in the iTunes on my iPhone but it did not show up.
    Does anyone know why and how I can transfer the audio book purchased on my iPhone so I can listen while away from the desk?
    Thank you,
    Sanya

    Can you find the audio book by using the Search feature on the iPod?
    Do you have the right boxes checked to sync the audio book to the iPod?
    iTunes: Syncing media content to iOS devices and iPod
    Note you have to check the boxes in Books pane for the iPod in iTunes to sync books in general and another box to sync Audio Books.

  • How can I remove a mailbox address from the "From" drop down box in a new e-mail my old e-mail address continue to populate as the sender address

    How can I remove a mailbox address from the "From" drop down box in a new e-mail my old e-mail address continue to populate as the sender address

    Hello,
    Try Mail>Preferences>Accounts icon>Account Information tab>Click on the Outgoing SMTP server drop down, choose edit Server list, highlight the old one & click Remove.
    (Such convolution is worthy of Windows® in my estimation)

  • How can I show menu on tv with apple tv remote

    I have my ATV onnected with a HDMI cable from my Apple TV to a HDMI input on my A/V Receiver.
    Then I use HDMI out on the A/V Receiver to connect to my HDTV with another HDMI cable.
    This has always worked just fine for me and still does,  just lately though I needed to check out the menu on my ATV which will be the first time since I set up my system.
    I have my system set up on a Universal Logitech Remote which is also working just fine for me.
    My problem is that I can't figure out how I can get the ATV menu to show up on my tv so that I can edit it.
    I've tried turning on the tv manually but when I do I get live tv playing and clicking on the ATV remote menu does not over-ride the live tv picture.
    Also tried turning on my Tivo with my universal remote but that also opens up the tv with a picture which the ATV remote can not over -ride
    Am I missing something obvious here or is my setup preventing me from seeing the menu.
    Thanks

    The correct answer is only with a limited number of apps, you cannot share the iPad screen, unfortunately. YouTube, iPhoto. I am very disappointed keynote presentations are not supported.

  • I am trying to play a DVD on my MacBook Pro and transmit it to my TV (use my TV as the monitor) utilizing a VGA cable and adapter for the Mac but the only image that shows up on the TV is the MacBook wall paper, any ideas on how I can transmit to my TV?

    I am trying to play a DVD on my MacBook Pro and transmit it to my TV (using my TV as the monitor) utilizing a VGA cable and adapter for the Mac but the only image that shows up on the TV is the MacBook wall paper, any ideas on how I can transmit the movie from my MacBook to the TV?  I also tried an HDMI cable and had the same issue.

    you are probably seeing the extended display.. to see ur main display go to pefrences then display steeings and turn mirroring on.
    this will display ur mbp main screen. good luck.

Maybe you are looking for

  • SAP HR UPGRADE

    Hi, Any documents related to SAP-HR upgrade from version 4.6C to ECC 6.0

  • After upgrading to 10.9.1, I can't enable iCloud services

    When I go to SysPrefs and select iCloud, it opens the iCloud window with all services gray'd out. It asks me to verify my apple password, then nothing happens.

  • BICSRemote webservice not present

    BICSRemote webservice is not present in WS-navigator in our portal. We are on NW 7,01 SP06 (ABAP and Java) which should be sufficient to make use Xcelsius/BICS Connector. Do I manually have to activate the BICSremote webservice somewhere?

  • HT1212 Please help me - Backup Passcode Locked - Need to restore

    Im trying to restore my old iphone with my new one. Old phone is off and backed up to icloud and computer.  When i plug in the new phone to itunes, it has this error message: Cannot connect to iphone . It is locked with a passcode. If i do not rememb

  • Crashing when wake from sleep

    Woke my computer from sleep today, should have been at least 3/4 charged, and it crashed when I woke it up. Turned on for a sec and was able to click on safari which was already up but then crashed. Plugged it into power source and still nothing afte