What does that error mean??? (see title of post)
The bolded line is the line it's reffering to:
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class playBalloon extends Applet implements ActionListener{
private Button btMake, btLeft, btRight, btUp, btDown, btGrow, btShrink, btPrev, btAR;
private Balloon newBalloon, wrkBalloon;
private Button newBut(String s) {Button bt = new Button(s); add(bt); bt.addActionListener(this); return bt;}
public void init()
{
btMake = newBut("Make"
btLeft = newBut("Left"
btRight = newBut("Right"
// btUp = newBut("Up"
// btDown = newBut("Down"
// btGrow = newBut("Grow"
// btShrink = newBut("Shrink"
btPrev = newBut("Prev"
btAR = newBut("All Right"
}
public void actionPreformed(ActionEvent event)
{
if (event.getSource() == btMake)
{Balloon prevBalloon = newBalloon; newBalloon = new Balloon(30,50,50,prevBalloon); wrkBalloon = newBalloon;}
if (wrkBalloon != null)
{
if (event.getSource() == btLeft) {wrkBalloon.moveH(-5);}
if (event.getSource() == btRight) {wrkBalloon.moveH(+5);}
if (event.getSource() == btUp) {wrkBalloon.moveV(-5);}
if (event.getSource() == btDown) {wrkBalloon.moveV(+5);}
if (event.getSource() == btGrow) {wrkBalloon.grow(+5);}
if (event.getSource() == btShrink) {wrkBalloon.grow(-5);}
if (event.getSource() == btPrev) {wrkBalloon = wrkBalloon.prev(); if (wrkBalloon == null) wrkBalloon = newBalloon;}
if (event.getSource() == btAR) {Balloon b = newBalloon; while (b != null) {b.moveH(3); b = b.prev();}}
}
repaint();
}
public void paint(Graphics g)
{if (newBalloon != null) newBalloon.display(g);}
}
class Balloon
{
private int diameter, xCoord, yCoord;
private Color color;
private Balloon pB;
public Balloon(int initialD, int initialX, int initialY, Balloon initialB)
{
diameter = initialD;
color = Color.black;
xCoord = initialX;
yCoord = initialY;
pB = initialB;
}
public void display(Graphics g)
{
g.setColor(color);
g.fillOval(xCoord, yCoord, diameter, diameter);
if (pB != null) pB.display(g);
}
public void moveH(int dX) {xCoord = xCoord + dX;}
public void moveV(int dY) {yCoord = yCoord + dY;}
public void grow(int dD) {diameter = diameter + dD;}
public Balloon prev() {return pB;}
}
I could really use your help on this one !!!
Thanx in advance,
BobbaFet Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
The bolded line is the line it's reffering to:
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class playBalloon extends Applet implements ActionListener{
private Button btMake, btLeft, btRight, btUp, btDown, btGrow, btShrink, btPrev, btAR;
private Balloon newBalloon, wrkBalloon;
private Button newBut(String s) {Button bt = new Button(s); add(bt); bt.addActionListener(this); return bt;}
public void init()
{
btMake = newBut("Make"
btLeft = newBut("Left"
btRight = newBut("Right"
// btUp = newBut("Up"
// btDown = newBut("Down"
// btGrow = newBut("Grow"
// btShrink = newBut("Shrink"
btPrev = newBut("Prev"
btAR = newBut("All Right"
}
public void actionPreformed(ActionEvent event)
{
if (event.getSource() == btMake)
{Balloon prevBalloon = newBalloon; newBalloon = new Balloon(30,50,50,prevBalloon); wrkBalloon = newBalloon;}
if (wrkBalloon != null)
{
if (event.getSource() == btLeft) {wrkBalloon.moveH(-5);}
if (event.getSource() == btRight) {wrkBalloon.moveH(+5);}
if (event.getSource() == btUp) {wrkBalloon.moveV(-5);}
if (event.getSource() == btDown) {wrkBalloon.moveV(+5);}
if (event.getSource() == btGrow) {wrkBalloon.grow(+5);}
if (event.getSource() == btShrink) {wrkBalloon.grow(-5);}
if (event.getSource() == btPrev) {wrkBalloon = wrkBalloon.prev(); if (wrkBalloon == null) wrkBalloon = newBalloon;}
if (event.getSource() == btAR) {Balloon b = newBalloon; while (b != null) {b.moveH(3); b = b.prev();}}
}
repaint();
}
public void paint(Graphics g)
{if (newBalloon != null) newBalloon.display(g);}
}
class Balloon
{
private int diameter, xCoord, yCoord;
private Color color;
private Balloon pB;
public Balloon(int initialD, int initialX, int initialY, Balloon initialB)
{
diameter = initialD;
color = Color.black;
xCoord = initialX;
yCoord = initialY;
pB = initialB;
}
public void display(Graphics g)
{
g.setColor(color);
g.fillOval(xCoord, yCoord, diameter, diameter);
if (pB != null) pB.display(g);
}
public void moveH(int dX) {xCoord = xCoord + dX;}
public void moveV(int dY) {yCoord = yCoord + dY;}
public void grow(int dD) {diameter = diameter + dD;}
public Balloon prev() {return pB;}
}
I could really use your help on this one !!!
Thanx in advance,
BobbaFet Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com