Usually to set the size and position of an element, you need to set the layout manager of the container that you are putting it in to null.