Forums Register Login

Setting custom font JOptionPane

+Pie Number of slices to send: Send
Does anyone knows how can I set a custom Font to a JOptionPane ??
The method showMessageDialog shows the dialog, but I dont know how ca I customize the font.
+Pie Number of slices to send: Send
The message is of type Object. If you create a JLabel and specify the font for the JLabel and then pass the JLabel as the message object, this should achieve the desired effect.
Kyle
+Pie Number of slices to send: Send
Thanks Kyle, it work!!, , but now, I have the message with a font and the buttons in the old thick ugly font ???
Do you know how to change the buttons font ?
+Pie Number of slices to send: Send
Create a JButton for each button and change the font. Use the showOptionDialog(...) method of JOptionPane. Wrap each of your buttons in an Object[] and pass as the option paramater to this method.
Kyle
+Pie Number of slices to send: Send
Thanks!!!
But, I've loose the default behavior though.
(
I think I would have to make a custom JDialog for this..
Thanks anyway
+Pie Number of slices to send: Send
Cool, just the problem I had. However, if I got \n (newlines) in the text, JLabel's aint enough, since then all the text is on one line. Suggestions to solve this?

Edit: Seems like JTextArea is the closest to the answer, although the bg color is white on that by default.. bah!

[ July 05, 2004: Message edited by: Daniel Akesson ]
[ July 05, 2004: Message edited by: Daniel Akesson ]
If you settle for what they are giving you, you deserve what you get. Fight for this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3752 times.
Similar Threads
Changing the color of a String...
How to make Large JOptionPane?
How do I include a custom font in a NetBean project?
JOptionPane
How to change the font of JOptionPane?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:46:48.