Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Simple Java program help

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Digg
Master Cheater
Reputation: 0

Joined: 14 Mar 2007
Posts: 362
Location: Houston, Texas

PostPosted: Sun May 03, 2009 9:56 pm    Post subject: Simple Java program help Reply with quote

Can anyone help me with this? Below is my code for a program


Code:
// Lab11ast.java
// This is the Student Version of the Lab11a assignment.


import java.awt.*;
import java.applet.*;
import java.util.*;
import java.util.Random;


public class Prog extends Applet
{   
   Color myColors[];
    Thread runner;
   
   public void paint(Graphics g)
   {
      int circleCount = 40;
      Circles circles = new Circles(g,circleCount);
   }
}


class Circles
{
   private int circleCount;
   private Random rnd;
   private Color randomColor;
   private int colorRow;
   
   private int redCount, greenCount, blueCount;
   
   public Circles(Graphics g,int c)
   {
      rnd = new Random(12345);
      circleCount = c;
      redCount = 1;
      greenCount = 1;
      blueCount = 1;
      drawSquares(g);
      for (int k = 1; k <= circleCount; k++)
         drawRandomCircle(g,k);
   }   
            
   public void drawSquares(Graphics g)
   {
      g.setColor(Color.red);
      g.fillRect(10,100,30,30);
      g.setColor(Color.green);
      g.fillRect(10,250,30,30);
      g.setColor(Color.blue);
      g.fillRect(10,400,30,30);
   }
   
   public void drawRandomCircle(Graphics g, int k)
   {
      if(circleCount<=17)
      Random r = new Random();
      Color red = new Color(r.nextInt(256),r.nextInt(256),r.nextInt(256));
      g.setColor(red);
      g.fillOval(k*50+10,100,30,30);
      Color green = new Color(r.nextInt(256), r.nextInt(256),r.nextInt(256));
      g.setColor(green);
      g.fillOval(k*50+10,250,30,30);
      Color blue = new Color(r.nextInt(256),r.nextInt(256), r.nextInt(256));
      g.setColor(blue);
      g.fillOval(k*50+10,400,30,30);
         
      
   }
   

   
   public void getRandomColor(Graphics g)
   {
      
   }



And the intended output is attached. Can anyone point me in the right direction?



clip_image002.jpg
 Description:
 Filesize:  39.27 KB
 Viewed:  2819 Time(s)

clip_image002.jpg



_________________
13x Bera Dexless DrK
I'm all open for HT runs, PM Me.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites