The below was provided by reader hans in response to Connect the Dots. The applet runs below and beneath that is the code. The applet should run below, but for some reason I'm getting
load: Sierpins.class is not public or has no public constructor.
java.lang.IllegalAccessException: Class sun.applet.AppletPanel can not access a member of class Sierpins with modifiers "" errors.
I'll try to fix this later. If anyone knows what the problem might be, please let me know.

Your browser is completely ignoring the <APPLET> tag!

import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import javax.swing.*;
import javax.swing.event.*;

class Sierpins extends JApplet{
   
   private boolean[] x;
   BufferedImage img;
   Graphics2D g;
   int y;
   int WIDTH = 850;
   int HEIGHT;
   JPanel panel;

   public static void main(String[] args){
      JFrame f = new JFrame("Sierpinski");
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setResizable(false);
      Sierpins triangle = new Sierpins();
      triangle.init();
      f.getContentPane().add(triangle);
      f.pack();
      f.setVisible(true);
   }
   
   public void init(){
      HEIGHT = WIDTH/2;
      this.setPreferredSize(new Dimension(WIDTH,HEIGHT));
      img = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB);
      g = img.createGraphics();
      g.setColor(Color.WHITE);
      g.fillRect(0,0,WIDTH,HEIGHT);
      g.setColor(Color.BLACK);
      x = new boolean[WIDTH];       x[WIDTH/2] = true;
      for(y=1;y<=HEIGHT;y++){
         draw(x,y);
         x = next(x);
      }
      panel = new JPanel(){
         public void paint(Graphics g){
            if(!(g instanceof Graphics2D)){return;}
            Graphics2D g2 = (Graphics2D)g;
            g2.drawImage(img,null,0,0);
         }
      };
      panel.setPreferredSize(new Dimension(WIDTH,HEIGHT));
      this.getContentPane().add(panel);
   }
   
   private void draw(boolean[] x, int y){
      for(int i=1;i<WIDTH;i++){
         if(x[i]){g.fillRect(i,y,1,1);}
      }
   }
   
   private boolean[] next(boolean[] x){
      boolean[] q = new boolean[WIDTH];
      int z = 0;
      for(int i=1;i<WIDTH-1;i++){
         //0X0 00X X00 X0X 000
         // 0 X X 0 X
         if(!x[i-1] && x[i] && !x[i+1]){q[i] = false;}
         else if(!x[i-1] && !x[i] && x[i+1]){q[i] = true;}
         else if(x[i-1] && !x[i] && !x[i+1]){q[i] = true;}
         else if(x[i-1] && !x[i] && x[i+1]){q[i] = false;}
         else if(!x[i-1] && !x[i] && !x[i+1]){q[i] = false;}
      }
      return q;
   }
   
   public void paint(Graphics g){
      if(!(g instanceof Graphics2D)){return;}
      Graphics2D g2 = (Graphics2D)g;
      g2.drawImage(img,null,0,0);
   }
}