public void drawRD(int x, int y){ int red=(int)(Math.random()*255); int green=(int)(Math.random()*255); int blue=(int)(Math.random()*255); Color randomColor=new Color(red,green,blue); gBuffer.setColor(randomColor); int diameter=(int)(Math.random()*90)+10; gBuffer.fillOval(x-diamter/2,y-diameter/2,diameter,diameter); }
public void update(Graphics g){ paint(g); }
public void paint(Graphics g){ gBuffer.setColor(Color.black); gBuffer.drawString("Click the applet to go!", 50,20); g.drawImage(Buffer,0,0,this); } }
If you want people to help you, it behooves you to reciprocate by providing well-formatted code (using the "java" tags mentioned under Formatting Your Post at the right, when you are posting and, more importantly explain what bugs you are trying to fix. With this post, you are asking people to read the badly formatted code, figure out what you were trying to do, then figure out what is wrong with it.
> If you want people to help you, it behooves you to > reciprocate by providing well-formatted code (using the > "java" tags mentioned under Formatting Your Post at > the right, when you are posting and, more importantly > explain what bugs you are trying to fix. With this > post, you are asking people to read the badly formatted > code, figure out what you were trying to do, then > figure out what is wrong with it. ********************************************************** Sorry as I said earlier it is all new to me. I apologize.. the errors I get are : When I compile I recieve these..
Mystery5.java uses or overrides a deprecated API. recomplie with -deprecation for details
Mystery5.java:27: cannot resolve symbol symbol: variable diameter location: class Mystery5 gBuffer fill Oval(x-diamter/2, ^ y-diameter/2,diameter,diamter);
Well, as far as compiler errors go, you have a misspelling of "diameter" (diamter) and a call to drawRB(), but a method called drawRD() -- since this method name is pretty close to meaningless, I don't know which is "correct," but either way, they need to match. Fixing these things will get it to compile with the -deprecation option, also changing your size() calls to getSize() calls will allow you to compile without the -deprecation flag.
In case you don't already know, "deprecated" means that the method shouldn't be used any more and has been replaced by some new (and hopefully better) method or way of accomplishing the same task.
> Well, as far as compiler errors go, you have a misspelling > of "diameter" (diamter) and a call to drawRB(), but a > method called drawRD() -- since this method name is pretty > close to meaningless, I don't know which is "correct," but > either way, they need to match. Fixing these things will > get it to compile with the -deprecation option, also > changing your size() calls to getSize() calls will allow > you to compile without the -deprecation flag. > > In case you don't already know, "deprecated" means that > the method shouldn't be used any more and has been > replaced by some new (and hopefully better) method or way > of accomplishing the same task.
**Hi Matt, I made the changes you asked me too. Here was the outcome
Mystery5.java:14: warning: mouseDown(java.awt.Event,int,int) in java.awt.Component has been deprecated
A .class file was created but I am not sure it will run in a html. Thanks again.
Is there a source where I can look at updated API components?