Java using Eclipse

Making a game with Java Eclipse

Page 1 of 1

7 Replies - 4396 Views - Last Post: 09 December 2010 - 03:21 PM Rate Topic: -----

#1 durrrr1989  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 08-December 10

Java using Eclipse

Posted 08 December 2010 - 05:24 AM

Hi guys,

At the moment im working on a project trying to create an Electronic Bandit in Java Eclipse, What i have doen at the minute is creat a GUI and put two buttons on the GUI name Close Program and Enter Name, After entering name i want to be able to make the program go to another page so i can start creating the electronic bandit!? can anyone help me with this, i also have a few more question on making the electronic bandit if anyone is willing to help it would be greatly appreciated!

Is This A Good Question/Topic? 0
  • +

Replies To: Java using Eclipse

#2 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,257
  • Joined: 27-December 08

Re: Java using Eclipse

Posted 08 December 2010 - 07:41 AM

You could use a CardLayout to switch Containers in the same JFrame, or you could create a new JFrame for your electronic altogether. You should probably have a submit button so the user can say that they are done entering the name.
Was This Post Helpful? 0
  • +
  • -

#3 durrrr1989  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 08-December 10

Re: Java using Eclipse

Posted 08 December 2010 - 04:53 PM

OK, thank you for that! but im learning Java in stages at the minute and im finding it really hard! one thing that i want to do is Make a randomizer for a one armed bandit so when you click the arm of the machine or the button you get 3 images that arm random if you know how what i mean!

would you recommend anything to me to help me with this?

:)

If you know of any good books or websites what are good to use, That would be brilliant! or i can pay you to do my assignment haha :)
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,257
  • Joined: 27-December 08

Re: Java using Eclipse

Posted 08 December 2010 - 05:11 PM

I would start out in the DIC Java Tutorials Section, as well as the Java Game Programming Thread pinned at the top of the Java forum. :)
Was This Post Helpful? 0
  • +
  • -

#5 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,257
  • Joined: 27-December 08

Re: Java using Eclipse

Posted 09 December 2010 - 12:43 PM

In response to your inquiry on randomization, see the java.util.Random class to generate a random number to allow you to choose your image. If you are using something like JLabel, you can set simply set the Icon. Otherwise, you may have to override paint() in the JComponent and manually draw the image.
Was This Post Helpful? 0
  • +
  • -

#6 durrrr1989  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 08-December 10

Re: Java using Eclipse

Posted 09 December 2010 - 02:20 PM

is it possible you can give me a some script so that i know what im doing? im just utterly a novice at this
Was This Post Helpful? 0
  • +
  • -

#7 m-e-g-a-z  Icon User is offline

  • Winning
  • member icon


Reputation: 496
  • View blog
  • Posts: 1,453
  • Joined: 19-October 09

Re: Java using Eclipse

Posted 09 December 2010 - 02:35 PM

If we gave you code, we would have to write and give everyone who posts on here code. I think it's probably best starting with something small and to build on from that. There is the Java tutorials on here which you can use and members here can provide links to good examples that they have come across. Heres a link to the Java Swing Tutorial. Feel free to post some code you have come up with and we will sure review it and help you with any errors that you are encountering
Was This Post Helpful? 0
  • +
  • -

#8 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,257
  • Joined: 27-December 08

Re: Java using Eclipse

Posted 09 December 2010 - 03:21 PM

I'll be happy to demonstrate basic usage of the Random class to help you understand how to use it. We'll be happy to further help you with your code and good faith efforts as well. :)
//the array to choose a random element from
int[] x = {4,2,1,3,5,6,7,9};

Random rand = new Random(); //create the Random object

//and display a randomly selected element in the array
System.out.println(x[rand.nextInt(x.length)]);


Was This Post Helpful? 1
  • +
  • -

Page 1 of 1