SHARE
TWEET

Untitled

reyhanzo Dec 15th, 2019 19 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.awt.*;
  2. public class TesApplet extends java.applet.Applet{
  3.  
  4.     public void paint(Graphics g){
  5.         Font f = new Font("SansSerif", Font.BOLD, 20);
  6.         g.setFont(f);
  7.         g.setColor(Color.BLUE);
  8.  
  9.         int xPusat = this.getSize().width/2;
  10.         int yPusat = this.getSize().height/2;
  11.  
  12.         String s = "Selamat Belajar Java Applet";
  13.         FontMetrics fm = this.getFontMetrics(f);
  14.         int posisiX = xPusat - (fm.stringWidth(s)/2);
  15.         g.drawString("Selamat Belajar java Applet", posisiX, yPusat);
  16.     }
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top