Java Doc for Polygon.java in  » 6.0-JDK-Modules » j2me » java » awt » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » java.awt 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.Polygon

Polygon
public class Polygon implements Shape,java.io.Serializable(Code)
The Polygon class encapsulates a description of a closed, two-dimensional region within a coordinate space. This region is bounded by an arbitrary number of line segments, each of which is one side of the polygon. Internally, a polygon comprises of a list of (xy) coordinate pairs, where each pair defines a vertex of the polygon, and two successive pairs are the endpoints of a line that is a side of the polygon. The first and final pairs of (xy) points are joined by a line segment that closes the polygon.
version:
   1.18, 07/01/98
author:
   Sami Shaio
author:
   Herb Jellinek
since:
   JDK1.0


Field Summary
protected  Rectanglebounds
    
public  intnpoints
     The total number of points.
public  intxpoints
     The array of x coordinates.
public  intypoints
     The array of y coordinates.

Constructor Summary
public  Polygon()
     Creates an empty polygon.
public  Polygon(int xpoints, int ypoints, int npoints)
     Constructs and initializes a polygon from the specified parameters.

Method Summary
public  voidaddPoint(int x, int y)
     Appends a point to this polygon.
 voidcalculateBounds(int xpoints, int ypoints, int npoints)
    
public  booleancontains(Point p)
     Determines whether the specified point is inside the Polygon.
public  booleancontains(int x, int y)
     Determines whether the specified point is contained by this polygon.
public  RectanglegetBoundingBox()
    
public  RectanglegetBounds()
     Gets the bounding box of this polygon.
public  booleaninside(int x, int y)
    
public  voidinvalidate()
     Invalidates or flushes any internally-cached data that depends on the vertex coordinates of this Polygon.
public  voidreset()
     Resets this Polygon object to an empty polygon.
public  voidtranslate(int deltaX, int deltaY)
     Translates the vertices by deltaX along the x axis and by deltaY along the y axis.
 voidupdateBounds(int x, int y)
    

Field Detail
bounds
protected Rectangle bounds(Code)



npoints
public int npoints(Code)
The total number of points.
since:
   JDK1.0



xpoints
public int xpoints(Code)
The array of x coordinates.
since:
   JDK1.0



ypoints
public int ypoints(Code)
The array of y coordinates.
since:
   JDK1.0




Constructor Detail
Polygon
public Polygon()(Code)
Creates an empty polygon.
since:
   JDK1.0



Polygon
public Polygon(int xpoints, int ypoints, int npoints)(Code)
Constructs and initializes a polygon from the specified parameters.
Parameters:
  xpoints - an array of x coordinates.
Parameters:
  ypoints - an array of y coordinates.
Parameters:
  npoints - the total number of points in the polygon.
exception:
  NegativeArraySizeException - if the value ofnpoints is negative.
since:
   JDK1.0




Method Detail
addPoint
public void addPoint(int x, int y)(Code)
Appends a point to this polygon.

If an operation that calculates the bounding box of this polygon has already been performed, such as getBounds or contains, then this method updates the bounding box.
Parameters:
  x - the x coordinate of the point.
Parameters:
  y - the y coordinate of the point.
See Also:   java.awt.Polygon.getBounds
See Also:   java.awt.Polygon.contains
since:
   JDK1.0




calculateBounds
void calculateBounds(int xpoints, int ypoints, int npoints)(Code)



contains
public boolean contains(Point p)(Code)
Determines whether the specified point is inside the Polygon. Uses an even-odd insideness rule (also known as an alternating rule).
Parameters:
  p - the point to be tested



contains
public boolean contains(int x, int y)(Code)
Determines whether the specified point is contained by this polygon.
Parameters:
  x - the x coordinate of the point to be tested.
Parameters:
  y - the y coordinate of the point to be tested. true if the point (xy) is contained by this polygon; false otherwise.
since:
   JDK1.1



getBoundingBox
public Rectangle getBoundingBox()(Code)



getBounds
public Rectangle getBounds()(Code)
Gets the bounding box of this polygon. The bounding box is the smallest rectangle whose sides are parallel to the x and y axes of the coordinate space, and that can completely contain the polygon. a rectangle that defines the bounds of this polygon.
since:
   JDK1.1



inside
public boolean inside(int x, int y)(Code)



invalidate
public void invalidate()(Code)
Invalidates or flushes any internally-cached data that depends on the vertex coordinates of this Polygon. This method should be called after any direct manipulation of the coordinates in the xpoints or ypoints arrays to avoid inconsistent results from methods such as getBounds or contains that might cache data from earlier computations relating to the vertex coordinates.
See Also:   java.awt.Polygon.getBounds
since:
   1.4



reset
public void reset()(Code)
Resets this Polygon object to an empty polygon. The coordinate arrays and the data in them are left untouched but the number of points is reset to zero to mark the old vertex data as invalid and to start accumulating new vertex data at the beginning. All internally-cached data relating to the old vertices are discarded. Note that since the coordinate arrays from before the reset are reused, creating a new empty Polygon might be more memory efficient than resetting the current one if the number of vertices in the new polygon data is significantly smaller than the number of vertices in the data from before the reset.
See Also:   java.awt.Polygon.invalidate
since:
   1.4



translate
public void translate(int deltaX, int deltaY)(Code)
Translates the vertices by deltaX along the x axis and by deltaY along the y axis.
Parameters:
  deltaX - the amount to translate along the x axis
Parameters:
  deltaY - the amount to translate along the y axis
since:
   JDK1.1



updateBounds
void updateBounds(int x, int y)(Code)



Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.