Why can't I access my panel's getWidth() and getHeight() functions?

后端 未结 3 1211
长情又很酷
长情又很酷 2020-12-03 23:11

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

3条回答
  •  情歌与酒
    2020-12-03 23:36

    I cannot tell the reason but:

    A way to avoid this is to override your getPreferredSize() function and return your preferred size.

提交回复
热议问题