Docsity
Docsity

Prepara i tuoi esami
Prepara i tuoi esami

Studia grazie alle numerose risorse presenti su Docsity


Ottieni i punti per scaricare
Ottieni i punti per scaricare

Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium


Guide e consigli
Guide e consigli


Font text field java changer, Appunti di Fondamenti di informatica

Appunti università della calabria - ingegneria informatica

Tipologia: Appunti

2021/2022

In vendita dal 12/10/2019

erty89qs
erty89qs 🇮🇹

4.5

(6)

42 documenti

1 / 3

Toggle sidebar

Questa pagina non è visibile nell’anteprima

Non perderti parti importanti!

bg1
25/5/2018 Change Font of JTextField Example
https://www.java-examples.com/change-font-jtextfield-example 1/3
JTEXTFIELD
Change Font of JTextField Example
March 3, 2018 1 Comment 1 Min Read
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
Change Font of JTextField Example
This java example shows how to change font of JTextField's text
using Java Swing JTextField class.
*/
import java.awt.FlowLayout;
import java.awt.Font;
import javax.swing.JApplet;
import javax.swing.JTextField;
/*
<applet code="JTextFieldFontExample" width=200 height=200>
</applet>
*/
public class JTextFieldFontExample extends JApplet{
public void init(){
//set flow layout for the applet
this.getContentPane().setLayout(new FlowLayout());
//create new JTextField
JTextField field = new JTextField("JTextField Change Font Example",30);
/*
* To set custom font for JTextField use,
* void setFont(Font font)
* method.
*/
//create new Font
Font font = new Font("Courier", Font.BOLD,12);
//set font for JTextField
field.setFont(font);
add(field);
}
}
pf3

Anteprima parziale del testo

Scarica Font text field java changer e più Appunti in PDF di Fondamenti di informatica solo su Docsity!

JTEXTFIELD

Change Font of JTextField Example

 March 3, 2018  1 Comment  1 Min Read

Change Font of JTextField Example This java example shows how to change font of JTextField's text using Java Swing JTextField class. */

import java.awt.FlowLayout; import java.awt.Font; import javax.swing.JApplet; import javax.swing.JTextField;

/* */

public class JTextFieldFontExample extends JApplet{

public void init(){

//set flow layout for the applet this.getContentPane().setLayout(new FlowLayout());

//create new JTextField JTextField field = new JTextField("JTextField Change Font Example",30);

/*

  • To set custom font for JTextField use,
  • void setFont(Font font)
  • method. */

//create new Font Font font = new Font("Courier", Font.BOLD,12);

//set font for JTextField field.setFont(font);

add(field); } }

Try one of the many quizzes. More than Java 400 questions with detailed answers.

Yes, I want to learn Java quickly

Want to learn quickly?

Facebook Twitter Google+ Pinterest Email WhatsApp

Receive LATEST Java Examples In Your Email

Enter your email address below to join 1000+ fellow learners:

email address

SUBSCRIBE

Comment