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.
[Only registered and activated users can see links. Click Here To Register...]
Printable View
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.
[Only registered and activated users can see links. Click Here To Register...]
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.Quote:
Originally Posted by Fusion T [Only registered and activated users can see links. Click Here To Register...]
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.Code:StringBuilder builder = new StringBuilder();
for (Component component : form.getComponents()) {
if (component instanceof JTextBox) builder.append(((JTextBox) component).getText()).append(" ");
}
String output = builder.toString();
I am using something like this in the project I am doing. Not sure if that helped any but, what the hell.