Mariah_South_Dakota
New Member
writing something that displays the prime numbers between 1-1000, twin primes between 1-1000, and perfect numbers between 1-10,000. not having any issues with writing those methods but the JOptionPane dialog box is driving me crazy right now. Working on trying to display 10 numbers per line for the prime numbers between 1-1000 \[code\] if( userChoice == 1 ) { message = String.format( "Prime Numbers between 1-1,000 are:"); for( number = 3; number <= 1000; number++ ) { if( trueCounter % 10 == 0 ) message += "\n"; prime = isPrime( number ); if( prime == true ) { message += " " + number; ++trueCounter; } } JOptionPane.showMessageDialog( null, message ); }\[/code\]thats what i have and it displays all the numbers and displays 10 numbers per line....but then it also displays a random number of extra lines in between so the dialog box height ends up getting way too big. and its even a set amount of extra lines which is what really confuses me... its like this\[code\]{3 5 7 11 13 17 19 23 29 31(8 new lines)37 41 43 47 53 59 61 67 71 73(10 new lines..)\[/code\]please help!