1
That code was meant to be when he clicked the button the same became invisible and the lblVira
becomes a number between 0 and 10, gives no error message and compiles only that the lblVira
not "grab" the new text (I’m new to java).
private void btnstartActionPerformed(java.awt.event.ActionEvent evt) {
btnstart.setVisible(false);
Random random = new Random();
int array[] = new int[1];
for (int i=1; i<array.length; i++) {
array[i] = random.nextInt(10);
lblVira.setText(Integer.toString(array[i]));
} }
You created a 1 position vector, then made a
for
that runs starting at 1 and going as 1 < 1, ie never. Thefor
shouldn’t start at 0? And why a 1 position array? Onlyint
would not be enough?– Woss