> Creat a class header named, Transfer, which extends Frame and implements
> ActionListener...........
...
> Create an instance method named Transfer and sets the frame to a BorderLayout,
> sets the first panel to a 4 by 2 Gridlayout, and set the second panel to a
[quoted text clipped - 5 lines]
> you tell me how i would do this step because im not quite sure of what i
> should do to solve this step..... Thank you very much
...
> public Transfer()
> {
> setLayout(newBorderLayout());
> dataFields.setLayout(new GridLayout(4,2));
>
> setLayout(new FlowLayout());
Note that your Transfer, with no return type, is a constructor, not an
instance method. It is bad practice to have instance methods whose name
matches the class name, because of the risk of confusion with
constructors, but if your assignment calls for it, you don't have much
choice.
I have a general comment on programming technique. Your code just sort
of stops, with missing braces. It may just be an artifact of newsgroup
posting, but just in case it is real...
Try as much of the time as possible to have a valid, working program
that does some subset of what needs doing. Test early, test often, very,
very often.
For information on how to add an ActionListener to a Button, read the
API documentation for Button.
Patricia
Bailey147 - 20 Mar 2006 16:14 GMT
>> Creat a class header named, Transfer, which extends Frame and implements
>> ActionListener...........
[quoted text clipped - 30 lines]
>
>Patricia
Patricia
Can you show me how to do these steps.......
Withing the transfer method add the labels and textfields to the first panel
and the buttons to the second panel. Add the Panels to the North and South
of the BorderLyout. Add the actionlistener to each button.
Patricia Shanahan - 20 Mar 2006 16:38 GMT
...
> Can you show me how to do these steps.......
>
> Withing the transfer method add the labels and textfields to the first panel
> and the buttons to the second panel. Add the Panels to the North and South
> of the BorderLyout. Add the actionlistener to each button.
I could, but I won't.
Ultimately, programming is a craft that can only be learned by doing. I
know the doing is difficult, when you have not yet learned the stuff you
can only learn by doing. It is still necessary. Watching me do it would
not teach you how to work through these things.
Try to take it a step at a time, and remember the API javadocs are your
friend. If you want to know how to do something to a Panel, go read
about Panel and see what methods it offers. Also, look at similar
examples in your notes and/or textbook.
But before going any further, get your program into a working state.
Don't necessarily do things in the order given. For example, when first
learning to use a GUI in a new language, I would display an empty frame
before worrying about putting anything in it, just to make sure I could.
Patricia