You need to use .equals()instead ==, for example:
if (value.equals("-1")){
control = 0;
}
When you use ==, you check referential equality (i.e. this is the same pointer), but when you use .equals(), you check the equality of values (i.e. whether they point to the same thing). This .equals()is usually the right choice.
You can also use breakto exit the loop, for example:
while( true ) {
String value = JOptionPane.showInputDialog( "Enter a number or -1 to stop" );
System.out.println( value );
if ( "-1".equals(value) ) {
break;
}
}