Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using 2 classes question

 
Brandon Woolwine
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Mansukhdeep Thind
Ranch Hand
Posts: 1158
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the ranch Brandon.

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.

b) Use code tags to paste code if you have any.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48985
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome again:

Train t = new Train(...);
t.moveLeft(123);
 
Brandon Woolwine
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Brandon Woolwine
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Mansukhdeep Thind
Ranch Hand
Posts: 1158
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Brandon Woolwine
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is for an into to java programming class and we are using bluej. This was in the instructions from our professor.
 
Winston Gutkowski
Bartender
Pie
Posts: 10417
63
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brandon Woolwine wrote:It is for an into to java programming class and we are using bluej. This was in the instructions from our professor.

I suspect this thread is more suited to the Swing forum, so I'm moving it there...

Winston
 
Mansukhdeep Thind
Ranch Hand
Posts: 1158
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic