What is the reason for that `if`? Maybe simpler will be 
```java 
   setMinimumSize(new Dimension(240, 240));
   pack();
``` and you don`t have to create above variable - consider it ;)