Consider to use GridBagLayout, it is very flexible.

java memory