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 


Java help again :(

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Thoxay
How do I cheat?
Reputation: 0

Joined: 15 Jul 2007
Posts: 3

PostPosted: Mon Jul 16, 2007 6:16 am    Post subject: Java help again :( Reply with quote

Quote:
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import java.util.*;
public class project
{
Button b,b1,b2,b3,b4,b5;
Frame f;
TextField tf;
TextArea ta;
Panel p,p1,p2;
int[] num = new int[7];
int i;
int counter = 0;
int correct = 0;




public void createFrame()
{

f = new Frame();
f.setTitle("Client");
f.setLayout(new BorderLayout());
p=new Panel();
p.setLayout(new GridLayout(2,2));

p1=new Panel();
p2=new Panel();


tf = new TextField(59);
p2.add(tf);


ta = new TextArea();
p1.add(ta);

b=new Button("Start");
p.add(b);
b1=new Button("Exit");
p.add(b1);
b2=new Button("Instructions");
p.add(b2);
b3=new Button("Lower");
p.add(b3);
b4=new Button("Higher");
p.add(b4);
b5=new Button("Bet");
p.add(b5);



f.add(p,BorderLayout.SOUTH);
f.add(p1,BorderLayout.NORTH);
f.add(p2,BorderLayout.CENTER);
f.setVisible(true);
f.pack();
WindowHandler wh= new WindowHandler();
f.addWindowListener(wh);
MouseHandler mh = new MouseHandler();
b.addMouseListener(mh);
b1.addMouseListener(mh);
b2.addMouseListener(mh);
b3.addMouseListener(mh);
b4.addMouseListener(mh);
b5.addMouseListener(mh);

b.setEnabled(false);
b1.setEnabled(true);
b2.setEnabled(true);
b3.setEnabled(false);
b4.setEnabled(false);
b5.setEnabled(false);

ta.append("Click on Instructions to begin\n\n");

}

public static void main(String args[])
{
project fw= new project();
fw.createFrame();
}

public class WindowHandler extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{

System.exit(0);
}
}

public class MouseHandler extends MouseAdapter
{
public void mouseClicked(MouseEvent e)
{
Button bclick =(Button)e.getSource();
if (bclick == b) //start button pressed

{
b.setEnabled(false);
b1.setEnabled(true);
b2.setEnabled(false);
b3.setEnabled(true);
b4.setEnabled(true);
b5.setEnabled(true);

Random r = new Random();

int result=0;
boolean numAssigned=false;
int j=0;
num[0] = 5;
result = r.nextInt(9)+1;


for (i=1;i<num.length;i++)
{

while (!numAssigned)
{


for (j=0;j<i;j++)
{
if (result== num[j])
{ result = r.nextInt(9)+1;
break;
}
}

if (j==i)
numAssigned = true;

}

num[i]=result;
numAssigned = false;
}


ta.append("First number: "+num[0]+"\n");




}
if (bclick == b1)
{
System.exit(0);
}

if (bclick == b2) //instructions
{
b.setEnabled(true);
b1.setEnabled(true);
b2.setEnabled(false);
b3.setEnabled(false);
b4.setEnabled(false);
b5.setEnabled(false);

ta.append("INSTRUCTIONS: Start from the number 5. Guess if the next number is \n\t\t HIGHER or LOWER.\n");
ta.append("Numbers will not be repeated and you only have 6 numbers to guess.\n\n");


}


if (bclick == b3) //lower
{

{





int j=counter+1;

if (num[j]<num[counter])
{
correct++;
ta.append("You got it!\n");
ta.append("Number is "+num[j]+"\n\n");


}
else
{
ta.append("Wrong!\n");
ta.append("Number is "+num[j]+"\n\n");

}
counter++;

if(counter==6)
{
ta.append("Thanks for Playing!\nHave a nice day!\n\n");
ta.append("You guessed "+correct+" out of 6 times correctly!\n\n");
b2.setEnabled(false);
b3.setEnabled(false);
b4.setEnabled(false);

}

}
}

if (bclick == b4) //higher
{

int j=counter+1;
if (num[j]>num[counter])
{
correct++;
ta.append("You got it!\n");
ta.append("Number is "+num[j]+"\n\n");

} else
{
ta.append("Wrong!\n");
ta.append("Number is "+num[j]+"\n\n");

}
counter++;

if(counter==6)
{
ta.append("Thanks for Playing!\nHave a nice day!\n\n");
ta.append("You guessed " +correct+" out of 6 times correctly!\n\n");
b2.setEnabled(false);
b3.setEnabled(false);
b4.setEnabled(false);


}

}

if (bclick == b5) //bet
{

//if bet button clicked


}



}
}




}


Is there a way to allow a user to bet at the start of every round ? Like there will be a pop up asking the user to place his bet and it will take that for a user input ?

Thanks in advance again..
Back to top
View user's profile Send private message
gmaster1440
Master Cheater
Reputation: 0

Joined: 26 Jun 2006
Posts: 365
Location: a,b,c++

PostPosted: Mon Jul 16, 2007 7:16 am    Post subject: Reply with quote

um...

add
Code:
int bet = 0;

under
Code:
int correct = 0;


Then make it so at the beginning of each round, it will check for bet at each round:
Code:
if (bet == 0) {
bet();
}


I haven't coded in java for a long time so make sure my stuff is mechanically correct (right number of spaces and such)...

Now that you made the option to start the "bet" void, you will need to actually code what the bet() will be all about. I cant help; you with that at the moment but i may reply later on. Good luck!

_________________
c++ pointers...
Back to top
View user's profile Send private message
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