I\'m writing a simple program to test out basic GUI. The program prints a letter in the middle of the screen and allows the user to move it with the arrow keys. Everything w
Member variables are initialized when the object is created (after the constructors of any parent classes & before constructor body of the current class. Swing does not doing any sizing work when the object is first created. Therefore, when you call getWidth() and getHeight(), no values have been set yet.