Puppy
Puppy

Reputation: 146910

WinAPI's MessageBox in Java

I'm looking for a quick and dirty way in Java to flash up a message box to the user, to return when they click OK. It's for an application termination condition, so I'm really not interested in oh here's mah JFrame and all the rest of it. The MessageBox function in the Windows API is exactly what I want, except I'm stuck in Javaland. Any recommendations for similar functions?

Edit: Now that I come to think of it, how the hell do you exit a Java app? The only way I've ever managed to close mine is by making a JFrame and having EXIT_ON_CLOSE.

Edit: Got it.

Upvotes: 4

Views: 515

Answers (3)

adf88
adf88

Reputation: 4442

Security issues makes your own dialog (not the system one) the best solution.

// edit
"own dialog" - I meant a dialog that runs in virtual machine

Upvotes: -2

xdevel2000
xdevel2000

Reputation: 21364

You could use:

JOptionPane.showMessageDialog(null, "blah blah blah");

it shows a message box centered relative to the screen, with an 'ok' button

Upvotes: 6

Goibniu
Goibniu

Reputation: 2221

Dialogs

Upvotes: 3

Related Questions