pseudo code:
int val = get a value from user into a local variable
if(test if val is good) {
savedVal = val; // save the good value
}else {
tell user input was bad. leave savedVal as...
Type: Posts; User: Norm
pseudo code:
int val = get a value from user into a local variable
if(test if val is good) {
savedVal = val; // save the good value
}else {
tell user input was bad. leave savedVal as...
I said: Use separate variables for getting the values and for drawing the rectangle.
Read the user's values into local variables, test the values are in range, then copy those variable's values...
height = Integer.parseInt(heightField.getText());
width = Integer.parseInt(widthField.getText());
Don't use height and width here. Use another variable that you can test to be in range. Then...
Use separate variables for getting the values and for drawing the rectangle.
Validate the given values first. If ok, set the values used for drawing.
Otherwise leave the old values as is.
There seems to be the sizes of two things to worry about. The applet and the rectangle.
It used to be that the applet's size was determined by the width and height attributes in the applet tag.
Can...
If the sizes entered by the user are out of bounds, display an error message and ignore the invalid values.
Are you trying to control the size of the applet in the browser's window or the size of...