I am using JGraphx 1.10.3.1 and I am trying to create a vertex that is the shape of an arrow. I have the following piece of code:

Object v1 = graph.insertVertex(parent, null, "Hello", 20, 20, 80, 30, "shape=arrow");

When I run it I get the following error:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at com.mxgraph.view.mxCellState.getAbsolutePoint(Unknown Source)
    at com.mxgraph.shape.mxArrowShape.createShape(Unknown Source)
    at com.mxgraph.shape.mxBasicShape.paintShape(Unknown Source)

It seems that the mxCellState does not have any AbsolutePoints set. I'm not sure what that means, but that's all I can gather from the output. Do I need to do something special to use the mxArrowShape shape for a vertex?

I believe I have everything set up correctly (a try {} finally {} block with the necessary begin and end update methods). Also if I change the last parameter to "shape=rectangle" or "shape=triangle", everything works fine.

asked 08 Oct '12, 03:32

tcjones's gravatar image

tcjones
11
accept rate: 0%

edited 08 Oct '12, 05:04

David's gravatar image

David
4.9k21831


The arrow shape is an edge, not a vertex. We don't have an arrow shaped vertex programmatically, but I think we do have one as a stencil, see section 4 of the user manual and the stencil shapes in the GraphEditor example.

link

answered 08 Oct '12, 05:16

David's gravatar image

David
4.9k21831
accept rate: 47%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×194
×79
×17

Asked: 08 Oct '12, 03:32

Seen: 2,003 times

Last updated: 08 Oct '12, 05:16