his is my java assignment. I really need help with it.
It is basicallY a Cyber Pet program where in you make the use of a GUI. Here is the file that you can download the whole question from.

http://www.mediafire.com/?gfw9c16tubdlf

You gotta have 2 packages : One for the GUI and the other for the CyberPet. The GUI package contains the GUI code . In the GUI package, there are 2 GUI.
GUI1 is a normal interface where it asks the user to choose the pet he/she wants. The feature of naming the pet also includes in this.
You can refer to this link .. I want the GUI to be somethin like this ..

http://download.oracle.com/javase/tutorial/uiswing/components/combobox.html

Check out the combo box demo .. It should display the picture while selecting the choice of the pet.
GUI1 also has a button named "Enter".
When you click on ENTER , it takes you to another frame that has displays the picture of the pet in the centre.
The GUI2 should possess a “Hungry” button which when pressed causes the pet to move towards its prey in steps of fixed length, while the prey continues to move in a random fashion. It also prints a console message “The pet is hungry”.

When the prey is within a pre-determined distance from the pet, the pet ‘eats’ the prey as follows:
(i) the frog shoots out a long red tongue that touches the fly and then the tongue retracts. The fly disappears and is assumed to be eaten.
(ii) The cat moves on top of the mouse so that the mouse is no longer visible and the mouse is assumed to have been eaten.
A console message is printed “The pet is no longer hungry”

It will display something saying "Pet is not hungry anymore" in the console when it has finished eating the prey.

This is using the just one pet.
Additional feature: If possible, make another GUI named GUI3 wherein all the pets go behind their respective preys and eat them up.

No applets . Plain pure java code needed.

Any help will be appreciated. Thankyou so much

P.s : Assignment question can be downloaded here.
http://www.mediafire.com/?gfw9c16tubdlf

You have left off what you have done so far.
Do you have any specific questions about the program you have to write?
You'll get better help if you show some effort in solving the problem.

Norm R1 : Thankyou for replying ..
Im actually new to Java. I was doing a completely different course but due to unforseen circumstances my university closed down and i moved to a new one. This is totallY beyond my field. Im trying my best here. :(

I'd like to know how do you move an image randomly across the JPanel that is created for it. As in suppose the pet is a cat . It moves randomly across the Panel and then it sees the mouse. When it is close by to the prey , it just jumps on it and the mouse disappears making it look like it has eaten the prey.

Can you please help me out with it ?

You can set the position of an image by using Graphics class drawImage() method. It has x,y parameters that you can set to an value you want. By changing the x,y values and repainting the image you can have the image move across a panel.

This sounds like an advanced project for a beginner. Start with a simple program to display an image. Then add to the code so that it moves the image to a new location: See the Timer class for a way to generate timer driven new positions ie new values of x,y and then repaint.
When that is working move to sensing where the cursor is etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.