明确告诉您:
没有。您可以这样实现:
用画线的方法,例:A(12,10)在屏幕上的一个点,从A到A,就画啦
没有。您可以这样实现:
用画线的方法,例:A(12,10)在屏幕上的一个点,从A到A,就画啦
解决方案 »
- 关于Java继承的一个小程序,请教下高手
- 文件系统 缺省系统 (org-netbeans-api-project-libraries/Libraries)中已存在文件
- 求小方法,如何在窗体上安放一个控件用来显示图片,是什么组件,用到什么方法?
- 为什么文本文件的内容不能直接拷到eclipse中?
- 为什么我打开页面时老是出现一个下载的对话框.
- 请教,关键字:MSSQL 存储过程 多数据集 可滚动。
- 在线等:用File类copy文件的时候怎么使源文件保留?
- help!!!!
- 我安装了jdk1.4,JAVA_HOME也设了,在cmd里面编译时报错:Exception in thread "main" java.lang.NoClassDefFoundError
- 我在调用FtpClient类的put(filename)函数时,报错???同样的代码为什么有的计算机上可以执行,有的就报异常?高分求救!
- 用simpledateformat一个日期后用什么方法输出,写出代码段给全分,谢谢
- 关于从java.sun.com下载的资料
更正一下我提供的方法也可以,但是jdk提供了有。请您看:java.lang.Object
java.awt.geom.Point2D
java.awt.Point
在这里了
java.awt.geom.Point2D
java.awt.Point这是java提供的画点类啊
我现在想找到fillrect()方法实现的源代码
/*
* @(#)Point.java 1.37 03/01/23
*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/package java.awt;import java.awt.geom.Point2D;/**
* A point representing a location in (x, y) coordinate space, specified
* in integer precision.
*
* @version 1.37, 01/23/03
* @author Sami Shaio
* @since JDK1.0
*/
public class Point extends Point2D implements java.io.Serializable {
/**
* The <i>x</i> coordinate.
* If no <i>x</i> coordinate is set it will default to 0.
*
* @serial
* @see #getLocation()
* @see #move(int, int)
*/
public int x; /**
* The <i>y</i> coordinate.
* If no <i>y</i> coordinate is set it will default to 0.
*
* @serial
* @see #getLocation()
* @see #move(int, int)
*/
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 JDK1.1
*/
public Point() {
this(0, 0);
} /**
* Constructs and initializes a point with the same location as
* the specified <code>Point</code> object.
* @param p a point
* @since JDK1.1
*/
public Point(Point p) {
this(p.x, p.y);
} /**
* Constructs and initializes a point at the specified
* (<i>x</i>, <i>y</i>) location in the coordinate space.
* @param x the <i>x</i> coordinate
* @param y the <i>y</i> coordinate
*/
public Point(int x, int y) {
this.x = x;
this.y = y;
} /**
* Returns the X coordinate of the point in double precision.
* @return the X coordinate of the point in double precision
*/
public double getX() {
return x;
} /**
* Returns the Y coordinate of the point in double precision.
* @return the Y coordinate of the point in double precision
*/
public double getY() {
return y;
} /**
* Returns the location of this point.
* This method is included for completeness, to parallel the
* <code>getLocation</code> method of <code>Component</code>.
* @return a copy of this point, at the same location
* @see java.awt.Component#getLocation
* @see java.awt.Point#setLocation(java.awt.Point)
* @see java.awt.Point#setLocation(int, int)
* @since JDK1.1
*/
public Point getLocation() {
return new Point(x, y);
} /**
* Sets the location of the point to the specified location.
* This method is included for completeness, to parallel the
* <code>setLocation</code> method of <code>Component</code>.
* @param p a point, the new location for this point
* @see java.awt.Component#setLocation(java.awt.Point)
* @see java.awt.Point#getLocation
* @since JDK1.1
*/
public void setLocation(Point p) {
setLocation(p.x, p.y);
} /**
* Changes the point to have the specified location.
* <p>
* This method is included for completeness, to parallel the
* <code>setLocation</code> method of <code>Component</code>.
* Its behavior is identical with <code>move(int, int)</code>.
* @param x the <i>x</i> coordinate of the new location
* @param y the <i>y</i> coordinate of the new location
* @see java.awt.Component#setLocation(int, int)
* @see java.awt.Point#getLocation
* @see java.awt.Point#move(int, int)
* @since JDK1.1
*/
public void setLocation(int x, int y) {
move(x, y);
} /**
* Sets the location of this point to the specified double coordinates.
* The double values will be rounded to integer values.
* Any number smaller than <code>Integer.MIN_VALUE</code>
* will be reset to <code>MIN_VALUE</code>, and any number
* larger than <code>Integer.MAX_VALUE</code> will be
* reset to <code>MAX_VALUE</code>.
*
* @param x the <i>x</i> coordinate of the new location
* @param y the <i>y</i> coordinate of the new location
* @see #getLocation
*/
public void setLocation(double x, double y) {
this.x = (int) Math.floor(x+0.5);
this.y = (int) Math.floor(y+0.5);
} /**
* Moves this point to the specified location in the
* (<i>x</i>, <i>y</i>) coordinate plane. This method
* is identical with <code>setLocation(int, int)</code>.
* @param x the <i>x</i> coordinate of the new location
* @param y the <i>y</i> coordinate of the new location
* @see java.awt.Component#setLocation(int, int)
*/
public void move(int x, int y) {
this.x = x;
this.y = y;
} /**
* Translates this point, at location (<i>x</i>, <i>y</i>),
* by <code>dx</code> along the <i>x</i> axis and <code>dy</code>
* along the <i>y</i> axis so that it now represents the point
* (<code>x</code> <code>+</code> <code>dx</code>,
* <code>y</code> <code>+</code> <code>dy</code>).
* @param dx the distance to move this point
* along the <i>x</i> axis
* @param dy the distance to move this point
* along the <i>y</i> axis
*/
public void translate(int dx, int dy) {
this.x += dx;
this.y += dy;
} /**
* Determines whether or not two points are equal. Two instances of
* <code>Point2D</code> are equal if the values of their
* <code>x</code> and <code>y</code> member fields, representing
* their position in the coordinate space, are the same.
* @param obj an object to be compared with this <code>Point2D</code>
* @return <code>true</code> if the object to be compared is
* an instance of <code>Point2D</code> and has
* the same values; <code>false</code> otherwise.
*/
public boolean equals(Object obj) {
if (obj instanceof Point) {
Point pt = (Point)obj;
return (x == pt.x) && (y == pt.y);
}
return super.equals(obj);
} /**
* Returns a string representation of this point and its location
* in the (<i>x</i>, <i>y</i>) coordinate space. This method is
* intended to be used only for debugging purposes, and the content
* and format of the returned string may vary between implementations.
* The returned string may be empty but may not be <code>null</code>.
*
* @return a string representation of this point
*/
public String toString() {
return getClass().getName() + "[x=" + x + ",y=" + y + "]";
}
}
那它怎么实现夸平台啊????