In Swing most layout managers ignore the size and use the preferred size instead. AWT's GridLayout uses the preferred size of the biggest components, to make sure all fit.
If this doesn't help you, you can still create a panel with a different layout (in AWT a FlowLayout comes to mind). Add the text field to that, then add the panel to the container. This notion of nesting layout managers is very common in Swing.