Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JFrame - Close Button

Status
Not open for further replies.

JackMH

Programmer
Nov 9, 2001
18
US
I have an application of which the main GUI is a JFrame and I require that the 'close' (X) button be disabled. I have used the setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE)which serves the purpose but is a little confusing to users who complain that "the close button doesn't work". Does anyone know how I can "grey out" the close button. I am assuming that it is a regular JButton and if I could get a reference to it I could use the setEnabled(false) method (derived from java.awt.Component) which would, I think do what I wish, but how do I get that reference ???.

 
I'm not great at Swing, and if no-one comes up with the goods, you could do --- when the user clicks on close, pop up a message box saying ("You are not allowed to exit the programme") !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top