Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8689857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:45:41+00:00 2026-06-12T23:45:41+00:00

I am trying to create a curved line in Piccolo2D with Java. This is

  • 0

I am trying to create a curved line in Piccolo2D with Java.

This is my code

public class MyCanvas extends PSwingCanvas{

 private void drawLine(PPath inSocket, PPath outSocket) {
  float startX = (float)inSocket.getX();
  float startY = (float)inSocket.getY()+4;
  float endX = (float)outSocket.getX()+8;
  float endY = (float)outSocket.getY()+4;

  PPath line = PPath.createLine(startX, startY, endX, endY);
  line.curveTo(endX+60,endY,startX-60,startY, startX, startY);
  getLayer().addChild(line);
 }


 public void testGraph(){
   PPath in = PPath.createEllipse(100f, 100f, 8, 8);
   PPath out = PPath.createEllipse(200f, 200f, 8, 8);
   this.getLayer().addChild(in);
   this.getLayer().addChild(out);
   drawLine(out,in);
 }

 public static void main(String[] args){
  final JFrame frame = new JFrame("Testing");
  MyCanvas canvas = new MyCanvas();
  canvas.testGraph();
  frame.getContentPane().add(editor);
  frame.setPreferredSize(new Dimension(600, 400));
  frame.pack();
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
          frame.setVisible(true); 
    }});
  }
 }

The graph that I get is :

enter image description here

How do I get rid of the original line segment between the two points so that I see only the curved line?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:45:43+00:00Added an answer on June 12, 2026 at 11:45 pm

    This is probably too late, but anyway, you can try the following:

    PPath line = new PPath();
    line.moveTo(endX, endY);
    line.curveTo(endX + 60, endY, startX - 60, startY, startX, startY);
    

    Here is a result based on the original code sample:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a curved border(border line with curved corner) for a
Trying to create a black line in my view to separate text blocks but
Trying to create a background-image slideshow and am getting this error... This is the
I am having a problem with my java code. I'm trying to make it
I trying create a class derivated from System.Web.UI.Page and in override Render i set
I am trying to create a line graph of a cosine curve along with
I am trying to draw a continuous curved line in flash. There are many
I need to write some code that will buffer a line to create a
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
I am trying create a delegate representation of constructor by emitting a Dynamic Method,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.