I am making an applet that will roll dice and print out the results. The results are printed using a variable string in a paint method, in this case "a". I am having issue making a new line before each set of new rolls and dont know what to do.
Here is the method I am having issues with:
public void roller(int sides, int rolls){
if(rolls>0){
a=a+"On a "+sides+" sided die you rolled: ";
for(int T=0; T<rolls; T++){
int result = (int)(Math.random()*sides+1);
a= a + result;
if(T<rolls-1){a=a+", ";}
repaint();
}
}
}
I have tried \n but that doesnt seem to work.
I have also tried using
newline = System.getProperty("line.separator");
but it wont seem to work either.
any and all help is apreciated thanks.
oh and if that was to vague please say >.<