wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes using 2  classes question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "using 2  classes question" Watch "using 2  classes question" New topic
Author

using 2 classes question

Brandon Woolwine
Greenhorn

Joined: Mar 29, 2013
Posts: 4
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

Joined: Jul 27, 2010
Posts: 1157

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.


~ Mansukh
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40034
    
  28
Welcome again:

Train t = new Train(...);
t.moveLeft(123);
Brandon Woolwine
Greenhorn

Joined: Mar 29, 2013
Posts: 4
Brandon Woolwine
Greenhorn

Joined: Mar 29, 2013
Posts: 4
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

Joined: Jul 27, 2010
Posts: 1157

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

Joined: Mar 29, 2013
Posts: 4
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

Joined: Mar 17, 2011
Posts: 8414
    
  23

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

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Mansukhdeep Thind
Ranch Hand

Joined: Jul 27, 2010
Posts: 1157

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using 2 classes question