I would like to create in Java a JOptionPane which should contain two different labels, Is it possible? If so, how to do it?
A:
JOptionPane do not consist of labels. It's a built in component for showing a standard pop up box with various buttons. You might wish to implement your own JFrame, that looks identical to a normal JOptionPane, with however way/many text included.
msakr
2010-06-27 21:00:50
or extend JOptionPane
Xorty
2010-06-27 21:05:33
A:
Your message parameter can be an array of JComponent objects which will be drawn in sequence. An example would be:
JLabel[] arr = {new JLabel("Paragraph 1"), new JLabel("Paragraph 2")};
JOptionPane.showMessageDialog(null, arr);
Tim Cooper
2010-06-27 21:07:52