2

The issue I am having is that I want to fill an oval, but I am using floats as my 'x' and 'y' values. Here is what I have:

@Override
public void paintComponent(Graphics g)
{
.
.
.
for(Coordinates cord : tempVertices)
{
    g.fillOval(cord.x,cord.y,DIAMETER,DIAMETER);
}
// DIAMETER = 10

// Coordinate Class is just a variable with an 'x' and 'y' value stored in floats
// Floats range from 0 to 1, so type casting won't work...

// tempVertices is just an ArrayList with Coordinates values

I am using NetBeans IDE 7.2 and I don't know how to override the fillOval method, and I cannot use an import from : import org.newdawn.slick.*; (It wouldn't recognize it). Is there a better Graphics option or easier way to achieve this simple fillOval?

4

1 に答える 1

4

任意の を受け入れるのfill()メソッドを探している可能性があります。Graphics2DShape

g.fill(new Ellipse2D.Float(cord.x, cord.y, DIAMETER, DIAMETER));

また、サポートされているjava.awt.RenderingHints.

于 2012-10-24T00:46:53.200 に答える