String username = "joshy@code.joshy.org";
String password = "satans";
String hostname = "code.joshy.org";
int port = 143;
Properties props = System.getProperties();
Session sess = Session.getDefaultInstance(props);
sess.setDebug(true);
Store store = sess.getStore("imap");
store.connect(hostname, port, username, password);
Folder inbox = store.getFolder("INBOX");
final int new_count = inbox.getUnreadMessageCount();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
//label.setText("You have " + new_count + " unread messages.");
if(new_count > 4) {
label.setFont(new Font("WebDings",Font.PLAIN,40));//label.getFont().getSize()));
label.setText(""+(char)0xf099);
} else {
label.setFont(new Font("WingDings",Font.PLAIN,40));//label.getFont().getSize()));
label.setText(""+(char)0xf02a);
}
System.out.println("unread messages = " + new_count);
}
});