Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- public class TesApplet extends java.applet.Applet{
- public void paint(Graphics g){
- Font f = new Font("SansSerif", Font.BOLD, 20);
- g.setFont(f);
- g.setColor(Color.BLUE);
- int xPusat = this.getSize().width/2;
- int yPusat = this.getSize().height/2;
- String s = "Selamat Belajar Java Applet";
- FontMetrics fm = this.getFontMetrics(f);
- int posisiX = xPusat - (fm.stringWidth(s)/2);
- g.drawString("Selamat Belajar java Applet", posisiX, yPusat);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement