permaculture playing cards*
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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: 1077
    
  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: 19685
    
  20

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
 
Don't get me started about those stupid light bulbs.
 
subject: How to show a message on my swings frame automatically when my network cable is unplugged