 <pre><code>JTextField textField = new JTextField(10); one.add(textField, BorderLayout.PAGE_START); one.add(f, BorderLayout.CENTER); </code></pre> <p>The default layout manager for a frame is the BorderLayout, so you need to add tomponens to a different area of the layout. Read the section from the Swing tutorial on <a href="http://docs.oracle.com/javase/tutorial/uiswing/layout/border.html" rel="nofollow">How to Use BorderLayout</a> for more information and examples. The tutorial also has examples of other layout managers and will show you how to better design your class.</p> <p>The tutorial also has a section on <code>Custom Painting</code> your should read because you also should set the preferred size of your custom painting panel.</p>