How can I set in the midst?

后端 未结 2 1466
忘掉有多难
忘掉有多难 2020-11-22 12:43

I try to draw a rectangular in Java. I set the frame size (800,400) and resizable(false) rectangular\'s x = 50, y = 50 width = 700 height = 300. Why isn\'t it in the middle

2条回答
  •  没有蜡笔的小新
    2020-11-22 12:59

        Rectangle rect = new Rectangle(50,50,700,300); 
    

    That should work fine, are you creating a new instance of Rectangle before you access member variables?

    Also 800 by 400 it kind of a weird resolution, 800 by 600 is more standard.

提交回复
热议问题