 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Mike Guest
|
Posted: Mon Nov 17, 2003 8:50 am Post subject: Newbie, trying to change font on MessageDialog |
|
|
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, "TitlennAuthornDate", "Window
Title", JOptionPane.INFORMATION_MESSAGE);
TIA,
Mike
|
|
| Back to top |
|
 |
Andrew Thompson Guest
|
Posted: Mon Nov 17, 2003 8:57 am Post subject: Re: Newbie, trying to change font on MessageDialog |
|
|
"Mike" <csdude (AT) hotmail (DOT) com> wrote
....
| Quote: | 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, "TitlennAuthornDate", "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
|
|
| Back to top |
|
 |
SPG Guest
|
Posted: Mon Nov 17, 2003 5:20 pm Post subject: Re: Newbie, trying to change font on MessageDialog |
|
|
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
"Mike" <csdude (AT) hotmail (DOT) com> wrote
| Quote: | 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, "TitlennAuthornDate", "Window
Title", JOptionPane.INFORMATION_MESSAGE);
TIA,
Mike
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|