I am trying to show the form many times here in this example 10 times, Can someone help me in doing it?
In the below example i am showing only button to keep it simple, along with the button i will add other components like textbox etc..., In the below example, i am getting the error- times should be made final. If i make it final then, i wont be able to write times = times - 1.
private void showForm(int times){
if(times >= 1){
JButton btn = new JButton("ADD");
container.add(btn);
times = times - 1;
btn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showForm(times);
}
});
}
}