Message Box wihout buttons

Hi, I need a message box like JOptionPane.showMessageBox(...) but without the buttons. The dialog box will be displayed while the program is exiting, so no buttons are needed. What is the easiest way to do this?Thanks,cmp2
[243 byte] By [cmp2a] at [2007-9-29 17:12:36]
# 1
Make your own dialog box and just show that....
aaabcdefga at 2007-7-15 15:55:42 > top of Java-index,Archived Forums,Java Programming...
# 2

One possible solution--

JLabel m = new JLabel("Program has terminated");

JPanel p = new JPanel();

p.add(m);

JFrame f = new JFrame();

f.add(p);

f.pack();

f.setVisible(true);

jnw777a at 2007-7-15 15:55:42 > top of Java-index,Archived Forums,Java Programming...
# 3

I didn't compile/test this...but should give you and idea.

public class MyDialog extends JDialog {

public MyDialog(String message) {

super();

setSize(100, 100);

getContentPane().add(new JLabel(message));

show();

}

}

aaabcdefga at 2007-7-15 15:55:42 > top of Java-index,Archived Forums,Java Programming...
# 4

I don't know that this would work, but you can give it a try.

One of the constructors for JOptionPane takes as one of its arguments an array of Options that get translated into the buttons to appear on the dialog. It is possible that if you send it a 0 length array that no buttons will appear. It is also possible that it will throw an error. You'll have to try it and find out.

puckstopper31a at 2007-7-15 15:55:42 > top of Java-index,Archived Forums,Java Programming...