This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
i am trying to use my Train class which has drawn a train and use it in my driver class so tat i can make the train move off of the screen. how do i add the train from my Train class to my Driver class?
Few pointers on how to go about using this forum to your best advantage.
a) Always provide the complete information about your use case. You claim that you have a Train class and a Driver class. You must be having. But we can't see those and can't understand what you are thinking in your mind. Put the code or at least the pseudo code here so that others may understand what is it that you have done, are doing and want to achieve. Get us to the point where you are stuck and then ask the question. Then you will get the best out of all of us.
That is my train class, i currently have no code for my driver class. i was trying to get my driver class to draw the train from my train class. the instructions talk about using a constructor and a GCanvas..however i have no idea what they are and how to use them..
Never heard of these classes myself Brandon. Where did you get these classes from? GRect, GLine etc. It sounds like they belong to some free graphic library. They are not a part of the standard JDK distributed by Oracle. And who is asking you to do this? Is this a problem given in a Java book? Or your teacher / instructor gave it to you?
the instructions talk about using a constructor and a GCanvas..however i have no idea what they are and how to use them..
Do you mean to say that you do not understand what is a constructor?
Joined: Mar 29, 2013
It is for an into to java programming class and we are using bluej. This was in the instructions from our professor.
Well, I am not into SWING/AWT or Java GUI design. Hence, I would not be able to help you in this case. Wait till one of the guys gets a grip on your problem. You will surely get some help. Till then maybe you can learn the basics of the language from a book called Head First Java if you are new to the language itself.