Reputation: 3
I am stuck at a point where I need a Timer which displays some time remaining when i click a button on the Jframe. But the timer frame should be a different frame and should be unclosable. Is there a way to do it?
Upvotes: 0
Views: 540
Reputation: 324128
different frame and should be unclosable.
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
The same can be done for a JDialog.
In both cases the close button will appear on the window, it just won't do anything.
Using a dialog is better than a frame because in general applications should only have a single JFrame and the child dialogs for other windows.
Upvotes: 1
Reputation: 285405
How about creating an undecorated non-modal JDialog?
Upvotes: 0