You dont set the size of components. You never do that.
The sizes of components, as well as their positions, are determined by the layout manager used in their parent.
Pick the right layout manager...