wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes How to show a message on my swings frame automatically when my network cable is unplugged Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to show a message on my swings frame automatically when my network cable is unplugged" Watch "How to show a message on my swings frame automatically when my network cable is unplugged" New topic
Author

How to show a message on my swings frame automatically when my network cable is unplugged

krishna neerukonda
Greenhorn

Joined: Jun 15, 2012
Posts: 6
Hi all,
I am new to swings, I have a requirement that i should show a message like "you are offline " when my network cable is unplugged and "You are now connected" when I plug network cable to my system. This should happen automatically.

Thanks in Advance,
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
and(s) the(s) question(s) related(s) to(s) swing(s) is(s)?
krishna neerukonda
Greenhorn

Joined: Jun 15, 2012
Posts: 6
Michael Dunn wrote:and(s) the(s) question(s) related(s) to(s) swing(s) is(s)?


can you post some solution please
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
perhaps a timer to constantly try a url connection might work, but it seems sloppy
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

First of all, it is 'Swing' and not swings as mentioned in the FAQ.

There is a class java.net.NetworkInterface which I think you can use to get the connected networks - I have never tried this though. You can read about this in the tutorial.
In any case, I think you will need a Timer as mentioned.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
krishna neerukonda
Greenhorn

Joined: Jun 15, 2012
Posts: 6
Michael Dunn wrote:perhaps a timer to constantly try a url connection might work, but it seems sloppy


is it possible to catch system notifications( balloon messages showing "network cable is unplugged" in windows operating system )and show on JLabel....?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Perhaps using JNI, although I wouldn't know the API calls and hooks to use myself.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to show a message on my swings frame automatically when my network cable is unplugged
 
Similar Threads
Issue with selection of text when textfield component gains focus.
DKU-5
getting IP address of Interface whose network cable is unplugged
Telnet Client fails to detect server disconnect during machine reboot