MM: Schriftart eines JOptionPanes ändern

Hallo zusammen!

Ich möchte die Schriftart eines JOptionPane's verändern. Was ich habe:
  
JOptionPane.showMessageDialog( Frame.this,
"FEHLER!",
"Warning",
JOptionPane.WARNING_MESSAGE );

Wie kann ich hier nun die Schriftart ändern?
Wer weiß Rat!

  1. Hi MM!

    JOptionPane.showMessageDialog( Frame.this,

    »»  "FEHLER!",
    »»  "Warning",
    »»  JOptionPane.WARNING_MESSAGE );

    Wie kann ich hier nun die Schriftart ändern?

    Also, im API steht nichts (http://java.sun.com/j2se/1.3/docs/api/javax/swing/JOptionPane.html). Du koenntest hoechstens bei den geerbten Methoden fuendig werden. Aber warum bastelst Du Dir nicht selbst einen MessageDialog? Geht doch schneller, als nach irgendsoeiner Methode zu suchen, die es wahrscheinlich doch nicht gibt.

    MfG Simon

    http://developer.java.sun.com/images/penduke.gif

    1. Hallo

      Also, im API steht nichts (http://java.sun.com/j2se/1.3/docs/api/javax/swing/JOptionPane.html). Du koenntest hoechstens bei den geerbten Methoden fuendig werden. Aber warum bastelst Du Dir nicht selbst einen MessageDialog? Geht doch schneller, als nach irgendsoeiner Methode zu suchen, die es wahrscheinlich doch nicht gibt.

      Doch sie gibt es:
      eine methode von javax.swing.JComponent

      public void setFont(Font font)

      Sets the font for this component.
           Overrides:
                setFont in class Container
           See Also:
                Component.getFont()

      Dazu aus java.awt.Font

      public Font(String name,
                  int style,
                  int size)

      Creates a new Font from the specified name, style and point size.
           Parameters:
                name - the font name. This can be a logical font name or a font face name. A logical name must be either: Dialog, DialogInput,
                Monospaced, Serif, SansSerif, or Symbol.
                style - the style constant for the Font The style argument is an integer bitmask that may be PLAIN, or a bitwise union of BOLD
                and/or ITALIC (for example, ITALIC or BOLDITALIC). Any other bits set in the style parameter are ignored. If the style argument
                does not conform to one of the expected integer bitmasks then the style is set to PLAIN.
                size - the point size of the Font
           Since:
                JDK1.0
           See Also:
                GraphicsEnvironment.getAllFonts(), GraphicsEnvironment.getAvailableFontFamilyNames()

      MfG

      Daniel Thoma