Replacing setSize method by resize