You may use setSize() method to set the size of JTextField component.
public void setSize(int width,
int height)
Resizes this component so that it has width width and height height.
Parameters:
width - the new width of this component in pixels
height - the new height of this component in pixels
Javadoc: http://docs.oracle.com/javase/1.4.2/docs/api/java/awt/Component.html#setSize(int, int)
Edit:
Any component added to the GridLayout will be resized to the same size as the largest component added. If you want a component to remain at its preferred size, then wrap that component in a JPanel and then the panel will be resized:
Also use setPreferredSize
instead of setSize
.