Example

public class ClassA extends Component {

private boolean bool1, bool2 = true;

public void componentResized (ComponentEvent e) {
setSize(getSize().width-1, getSize.height);
}

}


Solution
Remove the setSize() call inside componentResized(), as this will cause an infinite resize loop, .