Auto Update JLabel on JButton Press?
Code :
gen = new JButton("Generate");
add(gen);
gen.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
Random randomGenerator = new Random();
for (int idx = 1; idx <= 1; ++idx){
int randomInt = randomGenerator.nextInt(999);
test = new JLabel(""+randomInt+"");
add(test);
Random randomGenerator2 = new Random();
for (int idx2 = 1; idx <= 1; ++idx){
int randomInt2 = randomGenerator.nextInt(999);
test = new JLabel(""+randomInt2+"");
add(test);
Random randomGenerator3 = new Random();
for (int idx3 = 1; idx <= 1; ++idx){
int randomInt3 = randomGenerator.nextInt(9999);
test = new JLabel(""+randomInt3+"");
add(test);
}
}
}
}});;
};
}
Really need Some help.
Re: Auto Update JLabel on JButton Press?
please explain what are you up to?
Re: Auto Update JLabel on JButton Press?
When i Press the button it dose not show it until i minimize and bring back up