- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to change JLabel font in Java
To change JLabel font, use the setFont() method −
JLabel lable = label.setFont(new Font("Verdana", Font.PLAIN, 18));
Example
package my; import java.awt.Font; import javax.swing.*; public class SwingDemo { public static void main(String args[]) { JFrame frame = new JFrame("Label Example"); JLabel label; label = new JLabel("First Label"); label.setBounds(50, 50, 100, 30); label.setFont(new Font("Verdana", Font.PLAIN, 18)); frame.add(label); frame.setSize(300,300); frame.setLayout(null); frame.setVisible(true); } }
Output
- Related Articles
- How to change text font for JLabel with HTML in Java?
- How to change JLabel size in Java?
- How to change JLabel background and foreground color in Java?
- How to change JButton font dynamically in Java?
- Java Program to change JLabel text after creation
- How can we implement a JLabel text with different color and font in Java?
- How to change JTable's header font in Java
- How to change font size with HTML in Java Swing JEditorPane?
- How to change font size in HTML?
- How to change text font in HTML?
- How to change font size in ttk.Button?
- How to disable a JLabel in Java?
- How to add tooltip to JLabel in Java?
- How to add line border to JLabel in Java?
- How to change font face of Webview in Android?

Advertisements