Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / March 2006

Tip: Looking for answers? Try searching our database.

I want to know if i'm right or I need more info before I move on !!!

Thread view: 
Bailey147 - 20 Mar 2006 02:27 GMT
Here is what I have to do!!!!!!!!!!!!!!!!!

Import the java.io.*; and java.awt.event.* packages.........

Creat a class header named, Transfer, which extends Frame and implements
ActionListener...........

Type dataPOutputStream output to declare an output stream connection to the
data file..........

Construct 2 panels, four labels, and four textfields, and two buttons.  Give
them user friendly names.........

Create a main method that initiates a Transfer window and then sets its title,
size and visibility.....

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
flowlayout.............

Within 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 BorderLayout.  Add the  ActionListener to each button....  Can
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

import java.io.*;
import java.awt.*;
import java.awt.event.*;

public class Transfer extends Frame implements ActionListener

DataOutputStream output

Label BaileyLabel = new Label("Name:");
    TextField Bailey = new TextField(10);

Label HaleyLabel = new Label("Student ID:");
    TextField Haley = new TextField(10);

Label MoleyLabel = new Label("Transfer Course Number:");
    TextField Moley = new TextField(10);

Label PeanutLabel = new Label("Local Course NUmber");
    TextField Peanut = new TextField(10);

Panel Yamaha = new panel();
Panel Baja = new Panel();

Button SubmitButton = new Button("Submit");
Button ExitButton = new Button("Exit");

   public static viod main(String[] args)
   {
        Transfer window = new Transfer();
        window.setTitle("Transfer Course Substitutions");
        window.setSize(450, 250);
        window.setVisible(true);
   }

public Transfer()
{
   setLayout(newBorderLayout());
      dataFields.setLayout(new GridLayout(4,2));
         
   setLayout(new FlowLayout());
Patricia Shanahan - 20 Mar 2006 04:31 GMT
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.