Skip to content

Instantly share code, notes, and snippets.

@MichaelSDavid
Created July 6, 2021 19:18
Show Gist options
  • Save MichaelSDavid/b6dd03be1de0f6193adaa5b80a19a132 to your computer and use it in GitHub Desktop.
Save MichaelSDavid/b6dd03be1de0f6193adaa5b80a19a132 to your computer and use it in GitHub Desktop.
A small Java Applet that draws a minimalistic picture of Albert Einstein with a famous quote of his.
import javax.swing.JApplet;
import java.awt.*;
public class Applet extends JApplet {
// Einstein portrait
public void paint(Graphics page) {
page.drawRect(50, 50, 40, 40); // Square
page.drawRect(60, 80, 225, 30); // Rectangle
page.drawOval(75, 65, 20, 20); // Circle
page.drawLine(35, 60, 100, 120); // Line
page.drawString("Out of clutter, find simplicity.", 110, 70);
page.drawString("-- Albert Einstein", 130, 100);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment