Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to increase or reduce the font size in JFRame Title??

sunnycodeJul 13 2007 — edited Jul 14 2007
Hi, Sir:

How to increase or reduce the font size in JFRame Title??
See code below:
I hope to set String of "Borders" in JFrame frame = new JFrame("Borders");
to any size I like,
I use setFont etc, but not take effect,
Can guru here help??
Thanks

import java.awt.GridLayout;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;

public class TitledExample extends JPanel {

  public TitledExample() {
    super(true);

    this.setLayout(new GridLayout(1, 1, 5, 5));

    JLabel label = new JLabel("Titled Border");
    label.setHorizontalAlignment(JLabel.CENTER);

    TitledBorder titled = new TitledBorder("Title");
    label.setBorder(titled);

    add(label);
  }

  public static void main(String s[]) {
    JFrame frame = new JFrame("Borders");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200, 100);
    frame.setContentPane(new TitledExample());
    frame.setVisible(true);
  }
}

           
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 11 2007
Added on Jul 13 2007
1 comment
603 views