jQuery in Action, 2nd edition*
The moose likes Swing / AWT / SWT and the fly likes Rectangle constructor ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Rectangle constructor ?" Watch "Rectangle constructor ?" New topic

Rectangle constructor ?

Pin Ting

Joined: May 28, 2003
Posts: 22
Dear all ranchers,
I read this in the Java SE 1.4.1 API doc:
Rectangle(int x, int y, int width, int height)
Constructs a new Rectangle whose top-left corner is specified as (x, y) and whose width and height are specified by the arguments of the same name.
But I found the first two args really represent the "bottom-left" corner of the rectangle. What's the coordinate convention in Java library? Do I mistake something?
Pin Ting

Never do things the hard way if you don't have a good reason.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24183

You might be confused because in Java, as in most computer graphics environments, (0, 0) is the upper left corner of the screen, not the lower left, and increasing the Y coordinate moves downward -- the oppposite of a "normal" Cartesian coordinate system.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link: http://aspose.com/file-tools
subject: Rectangle constructor ?
Similar Threads
Using this() keyword in constructors
BorderLayout problem with NullLayout
Location and bounds of a component object
BorderLayout problem with NullLayout
rectangle size, brown color