|
Java example source code file (Point.java)
The Point.java Java example source code/* * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package java.awt; import java.awt.geom.Point2D; import java.beans.Transient; /** * A point representing a location in {@code (x,y)} coordinate space, * specified in integer precision. * * @author Sami Shaio * @since 1.0 */ public class Point extends Point2D implements java.io.Serializable { /** * The X coordinate of this <code>Point. * If no X coordinate is set it will default to 0. * * @serial * @see #getLocation() * @see #move(int, int) * @since 1.0 */ public int x; /** * The Y coordinate of this <code>Point. * If no Y coordinate is set it will default to 0. * * @serial * @see #getLocation() * @see #move(int, int) * @since 1.0 */ public int y; /* * JDK 1.1 serialVersionUID */ private static final long serialVersionUID = -5276940640259749850L; /** * Constructs and initializes a point at the origin * (0, 0) of the coordinate space. * @since 1.1 */ public Point() { this(0, 0); } /** * Constructs and initializes a point with the same location as * the specified <code>Point object. * @param p a point * @since 1.1 */ public Point(Point p) { this(p.x, p.y); } /** * Constructs and initializes a point at the specified * {@code (x,y)} location in the coordinate space. * @param x the X coordinate of the newly constructed <code>Point * @param y the Y coordinate of the newly constructed <code>Point * @since 1.0 */ public Point(int x, int y) { this.x = x; this.y = y; } /** * {@inheritDoc} * @since 1.2 */ public double getX() { return x; } /** * {@inheritDoc} * @since 1.2 */ public double getY() { return y; } /** * Returns the location of this point. * This method is included for completeness, to parallel the * <code>getLocation method of Other Java examples (source code examples)Here is a short list of links related to this Java Point.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.