Robert Williamsom
Robert Williamsom

Reputation: 3

creating a timer clock with java frame i.e Jframe

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

Answers (2)

camickr
camickr

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

Hovercraft Full Of Eels
Hovercraft Full Of Eels

Reputation: 285405

How about creating an undecorated non-modal JDialog?

Upvotes: 0

Related Questions