AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Newbie, trying to change font on MessageDialog

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java GUI Toolkits
View previous topic :: View next topic  
Author Message
Mike
Guest





PostPosted: Mon Nov 17, 2003 8:50 am    Post subject: Newbie, trying to change font on MessageDialog Reply with 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
Andrew Thompson
Guest





PostPosted: Mon Nov 17, 2003 8:57 am    Post subject: Re: Newbie, trying to change font on MessageDialog Reply with quote



"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





PostPosted: Mon Nov 17, 2003 5:20 pm    Post subject: Re: Newbie, trying to change font on MessageDialog Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java GUI Toolkits All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.