document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import java.awt.*;
  2. public class TesApplet extends java.applet.Applet
  3. {
  4.     public void paint (Graphics g)
  5.     {
  6.         Font f = new Font("SansSerif", Font.BOLD, 20);
  7.         g.setFont(f);
  8.         g.setColor(Color.BLUE);
  9.        
  10.         int xPusat = this.getSize().width/2;
  11.         int yPusat = this.getSize().height/2;
  12.        
  13.         String s = "Selamat Belajar Java Applet";
  14.         FontMetrics fm = this.getFontMetrics(f);
  15.         int posisiX = xPusat - (fm.stringWidth(s)/2);
  16.         g.drawString("Selamat Belajar java Applet", posisiX, yPusat);
  17.     }
  18. }
');