0

Rectangle left = new Rectangle(0,0,WIDTH/9,HEIGHT); In this code, if I increase the width why does it look like it extends farther over to the left on the JFrame? And if I decrease it why does it extend out to the right? Does this not work like a coordinate plain? Height makes a little more sense to me. If height is increased it extends up and if it is decreased it extends down.

Jamie
  • 3,890
  • 3
  • 26
  • 35
Martin Marino
  • 375
  • 2
  • 5
  • 14

1 Answers1

2

Swing draws with 0,0 being the top left corner, with positive X extending out to the right, and positive Y extending downwards. This can be confusing as some people expect 0,0 to be the bottom left corner.

If you are having trouble figuring out where thing are as opposed to where you think they would be, i would suggest just drawing the points of your shapes, and play around with that rather then trying to draw rectangles etc first.

dann.dev
  • 2,406
  • 3
  • 20
  • 32