{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

LineCrossPanel - LineCrossPanel.java Author Lewis and...

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

View Full Document Right Arrow Icon
//******************************************************************** // LineCrossPanel.java Author: Lewis and Loftus / Alicia Nicoll // // Solution to Programming Project 8.17 //******************************************************************** / import javax.swing.*; import java.awt.*; import java.awt.event.*; i public class LineCrossPanel extends JPanel { private final int DELAY = 20; private final int SHIFT = 1; private final int LENGTH = 40; private Timer timer; private int x, y, crossPoint; //----------------------------------------------------------------- // Sets up the panel. //----------------------------------------------------------------- public LineCrossPanel (Timer timer) { timer.addActionListener(new LineCrossActionListener()); //timer.start(); x = 0; y = 100; crossPoint = (int) (Math.random() * 100) + 50; setBackground (Color.black); } //----------------------------------------------------------------- // Draws the line in the current location. //----------------------------------------------------------------- public void paintComponent (Graphics page)
Background image of page 1

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

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}