Hi,
I'm pretty new to Java, so forgive me if I'm asking a stupid question.
But I've researched this online, and the only reference I'm finding is
with TextFields and TextAreas.
I'm using a MessageDialog box for a simple "about the program" window,
and I would like to change some of the fonts. Nothing major, just make
the title bigger, etc. How do I do this?
The line I'm using is like this:
JOptionPane.showMessageDialog(null, "Title\n\nAuthor\nDate", "Window
Title", JOptionPane.INFORMATION_MESSAGE);
TIA,
Mike
Andrew Thompson - 17 Nov 2003 08:57 GMT
...
> I'm using a MessageDialog box for a simple "about the program" window,
> and I would like to change some of the fonts. Nothing major, just make
[quoted text clipped - 3 lines]
> JOptionPane.showMessageDialog(null, "Title\n\nAuthor\nDate", "Window
> Title", JOptionPane.INFORMATION_MESSAGE);
JOptionPanes ar great if you do _not_ need to
customize them, and can instead accept one
of the many default configurations offered.
They are tricky to 'tweak' though.
You will probably achieve what you want much
faster using a JDialog.
HTH
--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
SPG - 17 Nov 2003 17:20 GMT
JOptionPane allows you to pass an Object as the message.
This means you can render JLabels to display your message.
For example:
public void showMessage(String message){
JLabel lblMessage = new JLabel(message);
lblMessage.setFont(new Font("Arial",Font.BOLD,14));
JOptionPane.showMessageDialog(null,new lblMessage,"TEST
TITLE",JOptionPane.INFORMATION_MESSAGE);
}
this will render your message using a bold arial forn sized at 14pts.
HTH
Steve
> Hi,
>
[quoted text clipped - 13 lines]
>
> Mike
Alan Moore - 18 Nov 2003 07:33 GMT
>Hi,
>
[quoted text clipped - 13 lines]
>
>Mike
Use HTML:. Enclose the message in <html></html> tags, then use <br>,
<font>, etc. to format the message.