Make sure your JFrame, JPanel and JTextField extend the correct classes (if they are custom classes).
Some pseudo code:
public class BetterText() extends JTextField{
public BetterText(){
super();
}
}
And then to create the GUI:
JFrame frame = new JFrame();
JPanel panel = new JPanel();
BetterText textField = new BetterText();
frame.add(panel);
panel.add(textField);
panel.pack();
panel.setVisible(true);