• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

traffic simulation

 
shepherd chagwedera
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there

I have a traffic simulation code that is producing a start:applet not initialized error each time i run it. Can u pliz have a look at my code and help me

this is the code

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to compile, I changed
Graph graph
to JPanel graph

compiled/ran, error, opened java console which showed
NumberFormatException, line 574
which is this line
carnum = Integer.parseInt(getParameter("carnum"));

changed to a hard-coded value
carnum = Integer.parseInt("10");

and the applet started OK
 
Sujitha Gali
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have made the corrections that you mentioned above but
I am still getting an error as below:

panel = new GraphPanel(this);
Its showing
constructor GraphPanel in class project.GraphPanel cannot be applied to given types;
required:javax.swing.JPanel
found:project.Graph
reason:actual argument project.Graph cannot be converted to javax.swing.JPanel by method invocation conversion
Its asking to create constructor GraphPanel(project.Graph) in project.GraphPanel
How to solve this?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic