Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

GeneralPath don't works  RSS feed

Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have used the GeneralPath Class to draw a path, but nothing appears on the screen...
If I draw with the Line2D Class everythings seems to be fine...
Does anyone sees some failure in my Code ? :

class CurvePanel extends JPanel {

GeneralPath path = new GeneralPath();

public CurvePanel() {

protected void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D)g;

public void addCurve(Vector v) {
int[] x = new int[v.size()+1];
int[] y = new int[v.size()+1];
int i = 0;

for (Iterator iter = v.iterator(); iter.hasNext() {
Point p = (Point);
x[i] = (int) p.getX();
y[i] = (int) p.getY();

for(int u=1;u<i;u++) {
path.moveTo(x[u], y[u]);

Even if I close the Path, there is no effect.
DoI have to close my Path?
[ July 30, 2004: Message edited by: Raschin Ghanad ]
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!