I have an abstract entity:
public abstract class Entity extends JPanel implements FocusListener
And I have a TextEntity:
public class TextEntity extends Entity
Inside TextEntity's constructor I want to put a JTextArea that will cover the panel:
textArea = new JTextArea();
textArea.setSize(getWidth(),getHeight());
add(textArea);
But getWidth()
and getHeight()
returns 0. Is it a problem with the inheritance or the constructor?