1) Create a JTextField with the same location as your Graphics.fillRect().
JTextField txtSomething = new JTextField(...)
2) Make the JTextField background transparent.
txtSomething.setBackground(new Color(0,0,0,0))
3) Run
There are other ways of doing this, try to research