Thread: Best way to collect data from a large amount of text fields?

Results 1 to 5 of 5
  1. #1 Best way to collect data from a large amount of text fields? 
    Banned

    Join Date
    Dec 2011
    Age
    28
    Posts
    1,323
    Thanks given
    146
    Thanks received
    151
    Rep Power
    0
    Title really says it all. I'm completely stumped on the best (performance-wise) way to grab data from each and every on of these.

    Reply With Quote  
     

  2. #2  
    Registered Member
    tommo's Avatar
    Join Date
    Aug 2008
    Posts
    420
    Thanks given
    30
    Thanks received
    36
    Rep Power
    200
    i don't quite understand what you're asking but if you just initialize the fields as an array of 30 or maybe a 2d array of 15/2 then you could just iterate through and collect the data (using field.getText()) as opposed to having a shit tonne of .getText() methods.
    23:06 <t4> of course, you can just reverse their wavygravy cipher to produce the public volatile boolean needed
    22:58 <t4> careful it sends bologna packets to the login servers
    22:58 <t4> very unsafe kernel flash
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Dec 2011
    Age
    28
    Posts
    1,323
    Thanks given
    146
    Thanks received
    151
    Rep Power
    0
    Quote Originally Posted by Fusion T View Post
    i don't quite understand what you're asking but if you just initialize the fields as an array of 30 or maybe a 2d array of 15/2 then you could just iterate through and collect the data (using field.getText()) as opposed to having a shit tonne of .getText() methods.
    Oh yeah should've been a bit clearer, my bad. What I need to do is grab the data in each field and then print it in just a spaced line. Like field1 + " " + field2. Etc.
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Jan 2012
    Posts
    593
    Thanks given
    527
    Thanks received
    319
    Rep Power
    0
    Code:
    StringBuilder builder = new StringBuilder();
    for (Component component : form.getComponents()) {
        if (component instanceof JTextBox) builder.append(((JTextBox) component).getText()).append(" ");
    }
    String output = builder.toString();
    You get the drift.. You need to modify this to work with your program (I'm not even sure if the method names are right, because I'm not personally going to check it). It isn't the best performance wise, but it defiantly is the shorted way to do it.
    Reply With Quote  
     

  5. #5  
    Registered Member Juistaa's Avatar
    Join Date
    Jan 2012
    Posts
    216
    Thanks given
    5
    Thanks received
    12
    Rep Power
    34
    I am using something like this in the project I am doing. Not sure if that helped any but, what the hell.
    XBL - Juistaa
    Steam - Juistaa
    Current Project - Nothing

    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Buying A Large Amount of RSGP
    By Vintage in forum Gold & Items
    Replies: 8
    Last Post: 03-21-2011, 11:22 PM
  2. Replies: 9
    Last Post: 01-06-2011, 09:09 PM
  3. Extra fields in "user"
    By Zee Best in forum Application Development
    Replies: 10
    Last Post: 12-06-2010, 06:12 PM
  4. Replies: 1
    Last Post: 09-26-2010, 07:01 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •