http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

a few java questions



Well, I might as well start out with the questions. I have to go to bed in a 
sec so, here goes:

Can the Java compiler produce .exe files or files ready to begin without 
having to have something else start it up?

How can I slow down my java compiler? Everytime I try to compile it comes up 
real fast and goes down even faster without seeing the errors or anything.

Can someone look at this code for me and tell me why it doesn't work?
It is just a small program that uses a lot of UI components so I could test 
a lot of them out. Oh, and to the person who showed me the Java API 
documentation, thanks. That place is loaded and it teaches how to use them 
pretty well. Heres the code:

import java.awt.*;
/*this is just a sample program to test out some UI components*/
public class uitest extends java.applet.Applet {
    public void init(boolean empty) {
        if(empty == true){
        setLayout(new FlowLayout(FlowLayout.LEFT));
        /*I want two buttons. One that says "submit form" and another
        that says "cancel" */
        Button submit = new Button("Submit Form");
        Button cancel = new Button("Reset Form");
        /* I want 5 text fields: name, address, phone number, age,
        and password */
        TextField name = new TextField("type your name", 27);
        TextField address = new TextField("your address here", 30);
        TextField phone = new TextField(15);
        TextField age = new TextField(3);
        TextField password = new TextField(8);
        TextField city1 = new TextField(10);
        //set an echocharacter for the password
        password.setEchoCharacter('*');
        /* I need one label for the top to say what the info is for
        I need a few more right next to the text fields to say
        what they are for */
        Label top2 = new Label("Enter account information");
        Label name2 = new Label("Name:", Label.LEFT);
        Label address2 = new Label("Address:");
        Label phone2 = new Label("Phone #:");
        Label age2 = new Label("Age:");
        Label password2 = new Label("Password:");
        Label blank2 = new Label("       ");
        Label blank3 = new Label("       ");
        Label blank4 = new Label("       ");
        Label blank = new Label("       ");
        Label blank6 = new Label("       ");
        Label blank5 = new Label("           ");
        Label blank7 = new Label("       ");
        Label interest = new Label("What are your interests?");
        Label occupation = new Label("What is your occupation?");
        Label city = new Label("city");
        Label money = new Label("Income:");
        CheckboxGroup income = new CheckboxGroup();
        Checkbox a30 = new Checkbox("$20,000-$30,000",income,false);
        Checkbox a40 = new Checkbox("$30,000-$40,000",income,false);
        Checkbox a50 = new Checkbox("$40,000-$50,000",income,false);
        Checkbox a60 = new Checkbox("$50,000-$60,000",income,false);
        Checkbox a70 = new Checkbox("$60,000-$70,000",income,false);
        Choice occ = new Choice();
        occ.addItem("Teacher");
        occ.addItem("Marketer");
        occ.addItem("Salesman");
        occ.addItem("Programmer");
        occ.addItem("Store owner");
        occ.addItem("Store worker");
        Checkbox books = new Checkbox("books");
        Checkbox movies = new Checkbox("movies");
        Checkbox music = new Checkbox("music");
        Checkbox compute = new Checkbox("computers");
        Checkbox tech = new Checkbox("technology");
        Checkbox family = new Checkbox("family fun");
        Checkbox shop = new Checkbox("shopping");
        /*Now it's time to put the labels, buttons, and textfields
        together. The first thing I add is the labels, then the
        text fields beside them */
        add(top2);
        add(blank4);
        add(interest);
        add(books);
        add(movies);
        add(music);
        add(compute);
        add(tech);
        add(family);
        add(shop);
        add(occupation);
        add(occ);
        add(blank3);
        add(money);
        add(a30);
        add(a40);
        add(a50);
        add(a60);
        add(a70);
        add(blank6);
        add(blank5);
        add(blank7);
        add(name2);
        add(name); //name
        add(address2);   //label....and so on
        add(address);
        add(phone2);
        add(phone);
        add(age2);
        add(age);
        add(password2);
        add(password);
        add(city);
        add(city1);
        /*now that I have added all the labels and text fields, I
        now add the buttons at the end. Note one thing. I added
        some add methods that included a label variable called blank
        now, blank is a label that has numbers like 2,3,4,5 and so on
        the numbers must be used because, as it seems to me, you can
        only add one label per panel of the same name. The blank
        labels are used to space the panel components*/
        add(blank);
        add(blank);
        add(blank2);
        add(submit);
        add(cancel);
        }
}
public boolean action(Event evt, Object arg) {
    if(evt.target instanceof Button)
    handlebutton((String)arg);
    return true;
}
void handlebutton(String nm) {
    if(nm.equals("Reset Form"))
    init(true);   //I call init with true in it saying that all the
    //textfields and everything are empty and it therefore resets the
    //screen
}
public static void main(String arg[]){
uitest test = new uitest();
test.init(true);
}
}



                                      Peace and may God
                                       direct your life
                                        Amen, Jonathan Smith

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once

To SUBSCRIBE or UNSUBSCRIBE please visit:
http://gameprogrammer.com/mailinglist.html