import java.awt.*;
import javax.swing.*;
public class FontExample implements Runnable {
public void run() {
Font labelFont = UIManager.getFont("Label.font");
System.out.println("Label.font is " + labelFont);
Font textareaFont = UIManager.getFont("TextArea.font");
System.out.println("TextArea.font is " + textareaFont);
//tweak:
UIManager.put("Label.font", textareaFont);
JPanel p = new JPanel();
p.add(new JLabel("here is a label"));
p.add(new JTextField("and here is a text field"));
JFrame f = new JFrame("ButtonExample");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setContentPane(p);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new FontExample());
}
}
> import java.awt.*;
> import javax.swing.*;
>
> public class FontExample implements Runnable {
>public void run() {
> Font labelFont =
> UIManager.getFont("Label.font");
> System.out.println("Label.font is " +
> labelFont);
> Font textareaFont =
> UIManager.getFont("TextArea.font");
> System.out.println("TextArea.font is " +
> textareaFont);
> //tweak:
> UIManager.put("Label.font", textareaFont);
>
> JPanel p = new JPanel();
> p.add(new JLabel("here is a label"));
> p.add(new JTextField("and here is a text
> field"));
>
> JFrame f = new JFrame("ButtonExample");
> f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
> f.setContentPane(p);
> f.pack();
> f.setLocationRelativeTo(null);
> f.setVisible(true);
>}
>public static void main(String[] args) {
>SwingUtilities.invokeLater(new FontExample());
>
> }
Thanks for the help
=)