As Carey has hinted, getContentPane is a method, so it must have ().
Why are you using that method at all, when you could use this method instead?
Why are you calling the class by such a vague name?
Why are you making the display class implement action listener? even though you will see that in many books, I don't think it is good object‑orientation.
In line 29: Give that method protected access, not public. Make its first line read super.paintComponent(g); That will remove any old painting before you start your new painting.
'frame.add(component)' will add the component to the center of the contentpane. If you do this a second time, you will overwrite your first component.
'super.paintComponent(g)' is indeed what you would normally do, but why does it not matter here?