Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.applet.*;
- import java.awt.*;
- public class CenteredText extends Applet
- {
- final Font f = new Font ("SansSerif", Font.BOLD, 18);
- public void paint(Graphics g)
- {
- Dimension d = this.getSize();
- g.setColor (Color.white);
- g.fillRect (0, 0, d.width, d.height);
- g.setColor (Color.black);
- g.setFont(f);
- g.drawString("WELCOME", 100, 100);
- g.drawRect (0, 0, d.width - 1, d.height - 1);
- }
- }
Add Comment
Please, Sign In to add comment