Friday 15 July 2011

java - I need to get and set text in JTextField, that I created using a for loop, usign a JButton -



java - I need to get and set text in JTextField, that I created using a for loop, usign a JButton -

i created these fields on container called ct , using grid handbag constraints called cons

for(int x=0;x<5;x++) { jtextfield txtdetails = new jtextfield(" "); cons.gridx = 1; cons.gridy = x+1; cons.gridwidth = 1; ct.add(txtdetails, cons); }

i using action listener can utilize buttons interact form created, want able clear fields , text each text field 1 1 i'm stuck.

usually create textfields individually own unique name time want seek save me writing same code 5 times

have tried store tetfields in dynamic datastructure such map, set or list?. iterate through , get, set or delete text. using set (unordered) or list (ordered) not able identify specific identifier (name, id, ...), using map set identifier key , textfield value pair allows unique textfield given identifier.

java for-loop jbutton jtextfield

No comments:

Post a Comment