How to Change Font Size in drawString Java
g.setFont(new Font("TimesRoman", Font.PLAIN, fontSize));
Where fontSize is a int. The API for drawString states that the x and y parameters are coordinates, and have nothing to do with the size of the text.
Is it possible to resize the text in a JLabel?
You can use the .setFont
method in a label, like so:
label = new JLabel("A label");
label.setFont(new Font("Serif", Font.PLAIN, 14));
Related Topics
Spark Strutured Streaming Automatically Converts Timestamp to Local Time
How to Handle Simultaneous Key Presses in Java
What Is the Purpose of the Java Constant Pool
Adding Points to Xyseries Dynamically with Jfreechart
How to Abort a Thread in a Fast and Clean Way in Java
Cannot Find Main Class in File Compiled with Ant
What Does the Colon (:) Operator Do
Why Can't We Use '==' to Compare Two Float or Double Numbers
How and Where to Use Static Modifier in Java
Why Does It Compile When Casting to an Unrelated Interface
Differencebetween Connection and Read Timeout for Sockets
Cast Object to Generic Type for Returning
Use Custom Manifest File and Permission in Unity
How to Find and Kill Running Win-Processes from Within Java
Converting a Jfreechart Timeseries Series with Day Data to Week or Month Data
Jvm Option -Xss - What Does It Do Exactly
How to Serve Jsps from Inside a Jar in Lib, or Is There a Workaround