I have an ArrayList with values in them, but I want to collect the weight of the ID which is to be inputted into the textfield, how can I make sure that the textfield either only allow integer inputs or verifies that there are not letters or symbols in the text?
ArrayList<String> dt = new ArrayList<>();
for (int i = 0; i < dt.length; i++) {
ID[i] = new JLabel();
ID[i].setText(dt[i]);
Pl.add(ID[i]); //PL is a panel
tf[i] = new JTextField();
Pl.add(tf[i]);
ID[i].setVisible(true);
tf[i].setVisible(true);
}