Reputation: 33
Into textfield i set the value (how many create components)
i have button:
JButton DoIt = new JButton("DoIt");
DoIt.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
newComp(textField.getText());
}
});
public static void newComp(String value)
{
for(int i=0;i<Integer.parseInt(value);i++)
{
panel.add(new JTextField( 5));
panel.revalidate();
panel.repaint();
}
How to identify components (name) when i set into textfield value: 4 and click on button? i Got 4 new components but i will use it to next step and i dont know how i will use method getText() to this.
Upvotes: 1
Views: 438