Sierpinski - import import import import import import...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.awt.Color; import java.awt.Point; import java.awt.Polygon; import java.awt.Graphics; import java.awt.Dimension; import java.awt.Component; import java.awt.BorderLayout; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import javax.swing.JFrame; import javax.swing.JSlider; import javax.swing.event.ChangeListener; import javax.swing.event.ChangeEvent; /** * Simple application that draws a Sierpinski Triangle fractal. */ public class Sierpinski extends JFrame implements ChangeListener, // To listen for changes to the slider ComponentListener // To reset the slider based on fractal size { /** * Component that recursively paints the fractal */ private SierpinskiPanel fractal = null; /** * Slider for adjusting the depth of the fractal */ private JSlider depth = null; public Sierpinski() { setTitle("Sierpinski Triangle Fractal Demo"); // Create the fractal panel and slider fractal = new SierpinskiPanel(); depth = new JSlider(1, 5); depth.setPaintTicks(true); depth.setPaintLabels(true); depth.setSnapToTicks(true); depth.addChangeListener(this);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Page1 / 4

Sierpinski - import import import import import import...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online