JTextField array help

Hey guys,
I'm working on a java GUI right now and I've come up with a problem, hopefully you guys can help.
I have a page that contains 50 text fields in 2 columns, so instead of making 50 lines of text field code, I decided to make an array of text fields and a for loop to cycle through each one (setting sizes, colors, editable, etc). Now the problem I'm running into is I will later down the road like to setText in these but it will be very cumbersome to have to call them by the arrayName[index #]. Just so I can better express what I mean heres is how I have to call each text field right now:
arrayName[0].setText("1");
arrayName[1].setText("2");
This is how I'd like to be able to call each field:
1stTextField.setText("1");
2ndTextField.setText("2");
Is there anyway I can make it so I can make an array of JTextFields and still be able to call an individual text field inside the array by name? If not, is there a way to point to another variable such as making
1stTextField = arrayName[0] ;
2ndTextField = arrayName[1];
Thanks for the help guys.

50 text fields in 2 columns... why not just use a JTable?
Is there anyway I can make it so I can make an array of JTextFields and still be able to call an individual text field inside the array by name?Try a HashMap
is there a way to point to another variable such as making
1stTextField = arrayName[0] ;
2ndTextField = arrayName[1]; Yes, exactly as you coded it up

Similar Messages

  • JtextField arrays newbie help

    Probem here
    import java.awt.*;
    import javax.swing.*;
    public class Display extends JFrame
    public static final int width = 500;
    public static final int height = 200;
    JPanel p;
    JTextField b[];
    for (int i = 0; i < 3; i++)
    b[i] = new JTextField();
    public Display()
    p = (JPanel) this.getContentPane();
    p.setLayout( new BorderLayout() );
    p.add(b[0], BorderLayout.NORTH);
    p.add(b[1], BorderLayout.CENTER);
    p.add(b[2], BorderLayout.SOUTH);
    for (int i = 0; i < 3; i++){
    b.setFont(new Font("Serif", Font.BOLD, 30));
    setSize(width, height);
    setVisible(true);
    public void paint(Graphics g){
    super.paint(g);
    However whenever i try to compile i always have an error of illegal start of type below for this part of code
    JTextField b[];
    for (int i = 0; i < 3; i++)
    b[i] = new JTextField();
    Please advise thanks!

    Don't forget to use the "Code Formatting Tags", so the posted code retains its original formatting.
    http://forum.java.sun.com/help.jspa?sec=formatting
    "Code" belongs in the constructor or a method.
    Only variables can be defined outside of the constuctor or methods.
    Also, why are you overriding paint(...)? Have you read the Swing tutorial for working examples?
    http://java.sun.com/docs/books/tutorial/uiswing/TOC.html

  • Loops and Arrays help

    Hi,
    I'm a freshman in college and new to java. I am completely lost and really need help with a current assignment. Here are the instructions given by my teacher...
    Building on provided code:
    Loops and Arrays
    Tracking Sales
    Files Main.java and Sales.java contain a Java application that prompts for and reads in the sales for each of 5 salespeople in a company. Files Main.java and Sales.java can be found here http://www.ecst.csuchico.edu/~amk/foo/csci111/labs/lab6N/Main.java
    and here http://www.ecst.csuchico.edu/~amk/foo/csci111/labs/lab6N/Sales.java It then prints out the id and amount of sales for each salesperson and the total sales. Study the code, then compile and run the program to see how it works. Now modify the program as follows:
    1. (1 pts) Compute and print the average sale. (You can compute this directly from the total; no new loop is necessary.)
    2. (2 pts) Find and print the maximum sale. Print both the id of the salesperson with the max sale and the amount of the sale, e.g., "Salesperson 3 had the highest sale with $4500." Note that you don't necessarily need another loop for this; you can get it in the same loop where the values are read and the sum is computed.
    3. (2 pts) Do the same for the minimum sale.
    4. (6 pts) After the list, sum, average, max and min have been printed, ask the user to enter a value. Then print the id of each salesperson who exceeded that amount, and the amount of their sales. Also print the total number of salespeople whose sales exceeded the value entered.
    5. (2 pts) The salespeople are objecting to having an id of 0-no one wants that designation. Modify your program so that the ids run from 1-5 instead of 0-4. Do not modify the array-just make the information for salesperson 1 reside in array location 0, and so on.
    6. (8 pts) Instead of always reading in 5 sales amounts, allow the user to provide the number of sales people and then create an array that is just the right size. The program can then proceed as before. You should do this two ways:
    1. at the beginning ask the user (via a prompt) for the number of sales people and then create the new array
    2. you should also allow the user to input this as a program argument (which indicates a new Constructor and hence changes to both Main and Sales). You may want to see some notes.
    7. (4 pts) Create javadocs and an object model for the lab
    You should organize your code so that it is easily readable and provides appropriate methods for appropriate tasks. Generally, variables should have local (method) scope if not needed by multiple methods. If many methods need a variable, it should be an Instance Variable so you do not have to pass it around to methods.
    You must create the working application and a web page to provide the applications information (i.e., a page with links to the source code, the javadoc and an object model) to get full credit. You can use the example.html's from the last two labs to help you remember how to do this.
    I'm not asking for someone to do this assignment for me...I'm just hoping there is someone out there patient and kind enough to maybe give me a step by step of what to do or how to get started, because I am completely lost from the beginning of #1 in the instructions.
    Any help would be much appreciated! Thank you!
    Message was edited by:
    Scott_010
    Message was edited by:
    Scott_010

    First ask the person who gave this asignment as to why do you require two classes for this , you can have only the Sales.java class with main method in it . Anyways.
    Let Main.java have a main method which instanciates a public class Sales and calls a method named say readVal() in Sales class.
    In the readVal method of sales class define two arrays i.e ids and sales. Start prompting the user for inputting the id and sales and with user inputting values keep storing it in the respective arrays .. Limit this reading to just 5 i.e only 5 salesPerson.
    Once both the arrays are populated, call another method of Sales class which will be used for all computations and output passing both the arrays.
    In this new method say Compute() , read values from array and keep calculating total,average and whatever you want by adding steps in just this loop. You can do this in readval method too after reading the values but lets keep the calculation part seperate from input.
    You must create the working application and a web page to provide the applications information (i.e., a page with links to the source code, the javadoc and an object model) to get full credit. You can use the example.html's from the last two labs to help you remember how to do this. I think this is ur personal stuff , but if you want to use web page , you probably will require to use servlet to read values from the html form passed to the server.

  • Reading from a text file in to an array, help please

    I have the following
    public class date extends Loans{
    public int dd;
    public int mm;
    public int yyyy;
    public String toString() {
    return String.format( "%d,%d,%d", mm, dd, yyyy );
    public class Loans extends Borrowing {
    public String name;
    public String book;
    public date issue;
    public char type;
    public String toString(){
    return String.format( "%s, %s, %s, %s", name, book, issue, type );
    import java.util.Scanner;
    import java.io.*;
    public class Borrowing extends BorrowingList {
    private Loans[] Loaned = new Loans[20];
    if i want to read in from a text file in to that array how do i do it?

    sorry to keep bothering you and thanks loads for your help but now I am getting the following error mesage
    C:\Documents and Settings\MrW\Menu.java:43: cannot find symbol
    symbol : class IOException
    location: class Menu
    }catch(IOException e){
    Note: C:\Documents and Settings\MrW\Borrowing.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 error
    BUILD FAILED (total time: 0 seconds)
    for this line
    }catch(IOException e){                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Populating 1D Array, Help with 1 Error

    Hello,
    I have just about finished a program that implements a .txt file containing a few records. The order is an int customerNumber, string firstName, string lastName, and float balance. The snipplet of code posted below is where I believe the problem lies, I just cant figure out where it is. Im not sure if my counter is not working correctly or what. The problem is that I'll input the customer number of the first record and it will output fine, but when I type in any other customer number, it returns null. It is supposed to return null if the customer number is not found in the array. The snipplet of code is posted below and if needed, i will post the entire program. Thanks for any help and feel free to ask questions:
    import java.util.Scanner;
    import java.io.*;
    public class customerList {
         private int count;
         private customerRecord data[];
         public customerList()
         data=new customerRecord[100];
         count=0;
    public void getCustomerList(String fileName) throws IOException
         while(count<100)
         Scanner scan=new Scanner(new File("/Users/kd/Documents/workspace/Assignment1/src/records.txt"));
              int customerNumber=scan.nextInt();
              String firstName=scan.next();
              String lastName=scan.next();
              float balance=scan.nextFloat();
              data[count]=new customerRecord(customerNumber, firstName, lastName, balance);
              count++;
    public customerRecord getCustomer(int customerNumber)
              for(int i=0; i<data.length; i++)
                   if(data.getCustomerNumber()==customerNumber)
                        return data[i];
              return null;

    ahh, i see....stupid mistake. would it still be 'legal' for me to do:
    public void getCustomerList(String fileName) throws IOException
         Scanner scan=new Scanner(new File("/Users/kevindoster/Documents/workspace/Assignment1/src/records.txt"));
         while(count<100)
              int customerNumber=scan.nextInt();
              String firstName=scan.next();
              String lastName=scan.next();
              float balance=scan.nextFloat();
              data[count]=new customerRecord(customerNumber, firstName, lastName, balance);
              count++;
    }or is there a problem with my limitations in the while loop

  • New Builder needs some info K9A Plat. RAID Array help

    This is a new build AMD 64x2 6000+, K9A platinum, Lite On DVD Re Writeable SATA, 2x74Gig WD Raptors in Raid 0, Asus X1950 pro Thermaltake 700 W PSU Crossfire cert.
    BIOS registered my drives, Built array PC Rebooted, Installing Win XP pro Hit F6 install drivers, Format drives, Then before Install  It says that :setup cannot copy the file ahcix86.inf.
    If I skip it, it will install XP but when I try to boot from the hard drive It starts to load XP but crashes to the blue screen of death
    *** Stop: 0x0000007BC ( 0xF78A2524, 0xC0000034, 0x00000000, 0x00000000)
    Has anyone got this error string?
    First RAID array I would very much appreciate any help given.

    Hi!
    Looking at some info on Google and Microsoft site, I cannot find the BC error code, only the error code ending with B. It indicates an error with the boot device. It can be caused by several things.
    Check that you are using the correct device drivers to install Windows
    Also, check the installation CD. It could be that the disk was damaged and that you are missing a crucial file because of that
    You can also try installing Windows again and choose to recover the previous installation.
    If this all does not help, try installing Windows on a single HDD (no raid) to see if that will work.

  • Comparing arrays - help!

    Hello. I've been trying to solve this problem for hours, and I would be most grateful for any help you can give me.
    Basically, I'm trying to compare two arrays of char and tell first how many are the same in the same place (I can do that) and then how many are the same but not in place. However, if there are two of one char in one array, and one of the same char in the other, I only want to count it once.
    The problem is, I can't figure out how to do this. I'm using for loops and then setting the char to 0 if it finds a match. This doesn't work. I tried using a series of if statements but I got weird run time acceptions sometimes, and when I put in more if statements to combat that, 1.) it got too confusing and 2.) still only worked half the time. So I'm back to the for loops.
    Here's what I have:
    for (int j = 0; j<guess1.length; j++){
    for(int k = 0; k<code1.length; k++){
    if(code1[k]== guess1[j]){
    code1[k]=0;
    guess1[j] = 0;
    almost = almost + 1;
    So if the code is BBYG and the guess is BWWY, it should return 1 correct and one almost. It will return the one correct, but then return 3 for the almost. It looks at the B in guess which already returned the correct and find it an almost against both B's. When it should have been set to 0 in the correct for loop.
    Sorry, I ramble a bit. Hope you can help!
    Thanks.

    You're gonna love this.
    Unless you have some annoying and patently backward lecturer who wants you to everything the hard way then get ye nose into:
    1. the Collections framework.
    http://java.sun.com/docs/books/tutorial/collections/index.html
    2. and the Collections class itself.
    http://java.sun.com/javase/6/docs/api/java/util/Collections.html
    Hint: a Map can be used to find the distinct items in a list.

  • Boolean Array-- Help Plz Urgent

    Can i create and initialize an array of booleans like this ?
    Boolean[51] Position = true;
    Thanks... Plz help

    This works:Boolean[] bools = {
        new Boolean(true), new Boolean(true), new Boolean(true), new Boolean(true),
        new Boolean(true), new Boolean(true), new Boolean(true), new Boolean(true),
        new Boolean(true), new Boolean(true), new Boolean(true), new Boolean(true),
        new Boolean(true), new Boolean(true), new Boolean(true), new Boolean(true),
        new Boolean(true), new Boolean(true), new Boolean(true), new Boolean(true),
        new Boolean(true), new Boolean(true), new Boolean(true), new Boolean(true),
        new Boolean(true), new Boolean(true), new Boolean(true), new Boolean(true),
        new Boolean(true), new Boolean(true), new Boolean(true), new Boolean(true),
        new Boolean(true), new Boolean(true), new Boolean(true), new Boolean(true),
        new Boolean(true), new Boolean(true), new Boolean(true), new Boolean(true),
        new Boolean(true), new Boolean(true), new Boolean(true), new Boolean(true),
        new Boolean(true), new Boolean(true), new Boolean(true), new Boolean(true),
        new Boolean(true), new Boolean(true), new Boolean(true)
    };... and, fortunately, so does this:Boolean[] bools = new Boolean[51];
    java.util.Arrays.fill(bools, new Boolean(true));I hope you find this of some help.

  • JTextField array

    I�m using an array of jTextFields within a pane and I want to know which of this jTextFields was edited. I used the getSource method but I cannot interpret the data since I don�t get the index of the jTextField.

    Or, if you really do want to know which field was editted, here's one possible solution
    import javax.swing.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.*;
    public class JTextFieldTester extends JFrame implements ActionListener{
        JTextField[] fields;
        public JTextFieldTester() {
            JPanel mainPane = (JPanel) getContentPane();
            mainPane.setLayout(new GridLayout(5,0,5,5));
            fields = new JTextField[5];
            for (int i = 0 ; i < 5 ; i++){
                fields[i] = new JTextField(20);
                fields.setName(""+i);
    fields[i].addActionListener(this);
    mainPane.add(fields[i]);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    pack();
    setLocationRelativeTo(null);
    setVisible(true);
    public void actionPerformed(ActionEvent e) {
    Component comp = (Component) e.getSource();
    if ( comp instanceof JTextField) {
    System.out.println(comp.getName());
    public static void main(String[] args) {
    new JTextFieldTester();
    This depends on user hitting enter after editting but you can do simular things with other types of events. The major point is that by assigning a name to each field you can rapidly determine which field fired the event. This is probably far more efficient for very large arrays of tields.
    Good Luck
    DB

  • Fixed Array help!!!

    i have a fixed array colection....how do i return the highest value in the array....but i need it to return its position in the array
    i have the running loop working to return the highest value in my array but i need it to store the position it is in
    double max = value[0];
            for(int i = 0; i < 12; i++)
                if(value[i] > max)
                    max = value;
    thnx alot for ur help!

    So you're saying this does not work?
    int indexOfMax = 0;
    double max = value[0];
    for(int i = 1; i < value.length; i++)
      if(value[i] > max)
        max = value;
    indexOfMax = i;

  • Urgent array help needed! come get some duke points

    this program keeps track of rentals for a shop. Other methods and classes not shown (like Customer, Transaction classes) are also in this program. Every item (created with a constructor in Item class) can hold an array of up to 20 transactions; part of a Transaction object is a rental total, based on a number of rental days * specific rental price for that item rented (backhoe, edger, etc.) If the user presses "t" for total amount of transactions, the following method is called, which calls the getTotalPrice() in another class called Item. My problem here is that even if I enter in transaction amounts, when I press "t", the program just quits, not producing the report and returning me to the main class. I have been over it with the debugger and I am still lost. Below is some selected code; I hope it is sufficient. Please let me know if I need to put up more
    //main
    String input = JOptionPane.showInputDialog(null, "Enter a rental transaction (x)" +
                                                      "\nAdd a customer (c)" +
                                                      "\nAdd an item (i)" +
                                                      "\nReport on a specific item (r)" +
                                                      "\nReport on total dollar amounts of rentals for all items (t)" +
                                                      "\nReport on total rentals for a specific customer (s)" +
                                                      "\nStrike cancel to exit from the program");
              //big huge while
              while (input != null){
                   if (input.equals("x")){
                        rentalTrans();
                   }//if
                   if (input.equals("c")){
                        addCustomer();
                   }//if
                   if (input.equals("i")){
                        addItem();
                   }//if
                   if (input.equals("r")){
                        specificItemReport();
                   }//if
                   if (input.equals("t")){
                        allItemReport();
                   }//if
                   if (input.equals("s")){
                        customerReport();
                   }//if
                   input = JOptionPane.showInputDialog(null, "Enter a rental transaction (x)" +
                             "\nAdd a customer (c)" +
                             "\nAdd an item (i)" +
                             "\nReport on a specific item (r)" +
                             "\nReport on total dollar amounts of rentals for all items (t)" +
                             "\nReport on total rentals for a specific customer (s)" +
                             "\nStrike cancel to exit from the program");
    //allItemReport()
    public static void allItemReport(){ //menu item t
              Item temp = null;
              for (int index = 0; index < items.length; index++){
                   temp = items[index];
              }//for
              JOptionPane.showMessageDialog(null, "Total rental transactions to date amount to: $" + temp.getTotalPrice());
    //Item Class
    public String getTotalPrice() {
              double total = 0;
              String output = "";
              for (int i = 0; i < trans.length; i++) {
                   if (trans[i] == null) {
                        if (i == 0) {
                             output = "There are currently no transactions.";
                        }// if
                        break;
                   }// if
                   else{
                   total += getPerDayRentalPrice();
                   }//else
              }// for
              output+= total;
              return output;
         }//getTotalPrice

    Don't flag your questions as urgent. It's rude. Also don't think that waving with a couple of worthless Dukes is going to get you better/quicker help.
    The reason I respond to your question is because you have explained your problem well and used code tags.
    Try this:class Main {
        public static void main (String[] args) {
            String message = "Enter a rental transaction (x)\nAdd a customer (c)" +
                "\nAdd an item (i)\nReport on a specific item (r)\nReport on total "+
                "dollar amounts of rentals for all items (t)\nReport on total rentals"+
                " for a specific customer (s)\nStrike cancel to exit from the program";
            String input = JOptionPane.showInputDialog(null, message);
            while(input != null){
                if (input.equals("x")) rentalTrans();
                else if (input.equals("c")) addCustomer();
                else if (input.equals("i")) addItem();
                else if (input.equals("r")) specificItemReport();
                else if (input.equals("t")) allItemReport();
                else if (input.equals("s")) customerReport();
                else System.out.println("Invalid option!");
                input = JOptionPane.showInputDialog(null, message);
            System.out.println("Bye!");
        // the rest of your methods ...
    }

  • Printing array help please!

    Hi, I have a problem with printing arrays in a certain order. Let me descbribe it, by the way I'm using Java version 1.3 if that helps.
    ok, what I need to do is print out on a single line all the strings found on the command line that end in .java and then I need to print out all the strings found on the command line that end in .class. So say I type on the command line a.java b.class c.java d.class. Then it would print out a.java c.java b.class d.class.
    any help would be appreciated!

    here it goes the complete code:
    * running example: java a.class b.java c.class d.class h.java
    public class Nickal01
         static public void main(String[] args)
              String classes = "";
              for(int i=0; i<args.length; i++)
                   if(args.endsWith(".class"))
                        classes += args[i] + " ";
                   else
                        System.out.print(args[i]+" ");
              System.out.println(classes);

  • Javascript array help needed to generate narrative from checkboxes

    For context...  the user will indicate symptoms in cardiovascular section, selecting "deny all", if none of the symptoms apply.  The narrative sub-form needs to processes diagnosis sub-form and generate text that explains the symptoms in a narrative form.  For example, if the user selects "deny all" in the cardiovascular section, the Cardiovascular System Review field would have:  "The patient denies:  High Blood Pressure, Low Blood Pressure.  The logic associated with the narrative needs to account for "deny all" and all the variations of selections.
    I have what I think is a pretty good start on the logic, but would like some help with the following:
    1) loading selected fields into the cv_1s array
    2) loading fields not selected into the cv_0s array
    3) generating the narrative
    See "phr.narrative.cv_nar::calculate - (JavaScript, client)" for the coding I've done thus far.  Feel free to comment on any efficiency opportunities you see.  I have a SAS programming background, but I'm new to Javascript.  Thanks...
    Rob

    Hi Rob,
    One approach would be to give your checkboxes the same name so they can then be referenced as a group and use the caption as the source of your text, so you shouldn't have to duplicate the text and will make it easier to add more later.
    Attached is a sample doing that.
    Hope it helps.
    Bruce

  • Array help needed!!!

    import java.lang.String;
    import java.io.*;
    import java.io.IOException;
    import java.util.*;
    import java.lang.Boolean;
    class Books
    public static final int SIZE=3;
    // public static final int LOAN;
    // public static final int RETURN;
    //public static final int QUERY;
    static int option;
    String title;
    String author;
    boolean loanStatus;
    String borrowerID;
    Date loanDate;
    Date dueDate;
    Books[]p0=new Books[SIZE];
    static void DisplayMenu()
    System.out.println("===Menu===");
    System.out.println("0 to Exit");
    System.out.println("1 to Borrow a book");
    System.out.println("2 to Return a book");
    System.out.println("3 to Query a book");
    System.out.print("===Your Choice>>");
    public static void main(String[] args)
    throws IOException
    BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
    String string;
    Books display =new Books();
    do
    System.out.println("\n\n");
    Date loanDate = new Date();
    Date dueDate = new Date();
    dueDate.setTime(loanDate.getTime() + (long)(24*60*60*1000)*14);
    System.out.println(loanDate);
    System.out.println(dueDate);
    display.DisplayMenu();
    System.out.flush();
    string=stdin.readLine();
    option=Integer.parseInt(string);
    switch(option)
    case 0:
    System.out.println("Exit");
    break;
    case 1:
    //display.displayBookList(Books[] p0)
    display.displayBookList(p0);
    display.loanBook();
    break;
    case 2:
    display.returnBook();
    break;
    }while(option!=0);
    void loanBook() throws IOException {
    BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
    String string;
    if(!loanStatus){
    System.out.println("Enter borrower ID: ");
    System.out.flush();
    borrowerID=stdin.readLine();
    loanStatus=true;
    else
    System.out.println("Book is on loan");
    public void Books()
    // Books[]p0=new Books[SIZE];
         loanStatus=false;      
    p0[0]=new Books();
    p0[0].title="Java Software Solution";
    p0[0].author="Lewis Loftus";
    p0[1]=new Books();
    p0[1].title="Java How To Programming";
    p0[1].author="Lewis Loftus";
    p0[2]=new Books();
    p0[2].title="Java";
    p0[2].author="Lewis Loftus";
    void returnBook()
    if( loanStatus)
    loanStatus=false;
    System.out.println("Book is return");
    else
    System.out.println("Book is Not on loan");
    static void displayBookList(Books[] p0)
    //Books display=new Books();
    System.out.println("===Book List===");
    System.out.println("0 Back To Main Menu");
    System.out.println("1 "+p0[0].title);
    System.out.println("2 "+p0[1].title);
    System.out.println("3 "+p0[2].title);
    System.out.print("===Your Choice>>");
    static void processBook(Books[] p0) throws IOException
    System.out.flush();
    string=stdin.readLine();
    option=Integer.parseInt(string);
    switch(option)
    case 0:
    display.DisplayMenu();
    break;
    case 1:
    break;
    case 2:
    display.returnBook();
    break;
    Does anyone know how why i cant access the array???

    Hello,
    After u make p0 as display.p0 inside choice 1 in your main method u can compile the code.
    But still there are some problems in ur code.
    1)when u will try running it and give option as 1.
    ur constructor --- public void Books() will not be called because its not a constructor at all its a method. In any case a constructor can not have a return type.
    if u give a return type to a constructor as given void by u.then that constructor wil be treated as a method and when u costruct the objects default costructor will be called. So ur constructor is never called.Thats why it will
    give u null pointer exception when u try to display the list of books.
    2) if u remove void from ur constructor...
    then also u are calling new Books() constructor again in side new Books() constructor, so it will go in to an infinite loop....
    so be clear what u want to do and then proceed..
    hope this will be of help.
    Amrainder

  • Font array help, please

    Hello
    I am a beginner to Flash and I am wondering if I can create
    an array so that the fields in my online form are input with the
    same size text and font style (10pt Arial normal is fine).
    At the moment, font/size do appear slightly different when
    data is entered in the form, although the Properties panel tells me
    they are the same.
    Would I do it something like this:
    inputs=[name_txt,email_txt,business_txt,country_txt,message_txt];
    for( var elem in inputs) {
    inputs[elem].fontColor = #ffffff;
    inputs[elem].fontStyle = Arial;
    A the moment, the code I have (which is not wonderful) looks
    like this:
    var mainTL:MovieClip = this;
    //start off with submit button dimmed <--I don't actually
    use this
    submit_mc._alpha = 80;
    var dataSender:LoadVars = new LoadVars();
    var dataReceiver:LoadVars = new LoadVars();
    create listener to 'wake up' submit button <--I don't
    actually use this
    var formCheck:Object = new Object();
    formCheck.onKeyUp = function() {
    if (name_txt.text != '' &&
    email_txt.text != '' &&
    business_txt.text != '' &&
    country_txt.text != '' &&
    message_txt.text != '') {
    //clear any alert messages
    alert_txt.text = '';
    //enable the submit button
    submit_mc._alpha = 100;
    } else {
    //remain disabled until all fields have content
    submit_mc._alpha = 80;
    Key.addListener(formCheck);
    /*#######SET STYLES FOR TEXT FIELDS <--I don't actually
    use this#######*/
    //define styles for both normal and focussed
    //set hex values here that work with your site's colors
    var normal_border:Number = 0x000000;
    var focus_border:Number = 0x000000;
    var normal_background:Number = 0xffffff;
    var focus_background:Number = 0xffffff;
    var normal_color:Number = 0x000000;
    var focus_color:Number = 0x000000;
    inputs=[name_txt,email_txt,business_txt,country_txt,message_txt];
    for( var elem in inputs) {
    inputs[elem].border = true;
    inputs[elem].borderColor = normal_border;
    inputs[elem].background = true;
    inputs[elem].backgroundColor = normal_background;
    inputs[elem].textColor = normal_color;
    inputs[elem].onSetFocus = function() {
    this.borderColor = focus_border;
    this.backgroundColor = focus_background;
    this.textColor = focus_color;
    inputs[elem].onKillFocus = function() {
    this.borderColor = normal_border;
    this.backgroundColor = normal_background;
    this.textColor = normal_color;
    Selection.setFocus(name_txt);
    submit_mc.onRelease = function() {
    if (name_txt.text != '' &&
    email_txt.text != '' &&
    business_txt.text != '' &&
    country_txt.text != '' &&
    message_txt.text != '') {
    alert_txt.text='';
    mainTL.play();
    dataSender.name = name_txt.text;
    dataSender.email = email_txt.text;
    dataSender.business = business_txt.text;
    dataSender.country = country_txt.text;
    dataSender.message = message_txt.text;
    dataReceiver.onLoad = function() {
    if (this.response == "invalid") {
    mainTL.gotoAndStop(1);
    alert_txt.text = "Sorry, but your email address appears
    invalid"
    } else if (this.response == "passed") {
    mainTL.gotoAndStop(4);
    //send data to ASP
    dataSender.sendAndLoad("Email.asp", dataReceiver, "POST");
    } else {
    alert_txt.text = "Please complete all fields";
    Many thanks for any help.
    Steve

    I have done that it the Properites panel but when I click
    CTRL and Enter and complete the email form myself, I can see there
    is a difference in fonts in one of the fields - although the
    Properties panel tell me otherwise.
    I just though AS would force the issue.
    Steve

Maybe you are looking for

  • Sending email to 10,000 addresses without knowing Host and Protocols!!

    Context: I am building an "eMail Marketing Campaign" application which takes a list of email addresses (unlimited) and sends an eMail to all of them. My servlet creates an instance of "MyMailHandler.java/class" and passes a list of addresses. Problem

  • Scanning interface with epaon printer

    I have a WF-7520 & WF-4530 & WF-3640 All-in-One Printers. I had been using the WF-4530 for scanning using Adobe Acrobat X, version 10.1.12. The combination of Adobe and WF-4530 worked perfectly for several years. Then the WF-4530 started profusely le

  • Forecast based planning -weekly schedules split -reg

    Hi, our requirement is we use forecast  based planning where in both forecast periods and historical periods are months then when fore cast is run requirement is coming in Md04 in monthly buckets only when we run MRP the out put schedules should come

  • Password to move items to the trash on my iMac?

    Today, my iMac started asking me for my password to move items to the trash. In addition, if I do put the password in, it automatically deletes the file from the trash. This does not happen when I move items from external drives to the trash. I'm usi

  • F4 / Help Functionality for input field in custom java iView

    Hi, As we see many F4 help on each input field in a transaction, how can we mimic the same functionality in a Custom Java iView. For example, ME23N, you can search a PO based on some criteria, when i create a new custom java iview using BAPI_PO_DISPL