I am using linux computers and on one computer I am setting my DISPLAY to COMP1 and then starting a Java Gui program on COMP2. The problem is that when I disconnect the network cord or log out of COMP1 the Java program continues running fine on COMP2 without any indication that the display is no longer accessable. This is a problem because that Gui had a "master gui" status and since the process still thinks everything is fine it doesn't give up that "master gui" status so that it can be available for other guis.

Is there some way that I can detect if the connection (I think it might be the X connection) from the java process to the display is no longer available? If I can detect that then I can just have that process exit and free up the "master gui" status.

Iíve tried using GraphicsEnvironment but that doesn't work. GraphicsEnvironment.isHeadless() is always returning false even when I unplug the network cord. GraphicsEnvironment.getCenterPoint() is always returning a valid point. I was hoping it might return null or (0,0) if the network cord was unpluged.