Trabalhando com fontes
/*
* Main.java
*
* Created on 12 de Fevereiro de 2007, 19:37
*/
package fonts;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
*
* @author adrw
*/
public class Main extends JFrame {
/** Creates a new instance of Main */
public Main() {
super("Controle
de Fontes");
setSize(400,
125);
setVisible(true);
}
public void paint( Graphics g )
{
super.paint(
g );
g.setFont(
new Font("Serif", Font.BOLD, 12) );
g.drawString(
"Serif 12 negrito", 20, 50 );
g.setColor(
Color.red );
g.setFont(
new Font("Verdana", Font.PLAIN, 18) );
g.drawString(
g.getFont().getName() + " " + g.getFont().getSize(), 20, 100 );
}
/**
* @param args the command line arguments
*/
public static void main(String[]
args) {
Main
app = new Main();
app.setDefaultCloseOperation(
JFrame.EXIT_ON_CLOSE );
}
}
|