Bluefire
Bluefire

Reputation: 14109

JS-style alert box in java

What's the Java Swing counterpart for the JavaScript alert() popup (if there is one)?

Upvotes: 2

Views: 5554

Answers (3)

Christopher Peisert
Christopher Peisert

Reputation: 24124

How to create a dialog box in Java:

Upvotes: 2

Howard
Howard

Reputation: 39197

An basic way to accomplish such a popup is to use JOptionPane.showMessageDialog, see here.

JOptionPane.showMessageDialog(frame, "here comes the text.");   
// assumes frame to be a reference to the desired parent frame

Upvotes: 7

barsju
barsju

Reputation: 4446

Think you are looking for JOptionPanes but here is a good description of the different dialogs: http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html

Upvotes: 2

Related Questions