Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <a href="http://docs.oracle.com/javafx/2/api/javafx/scene/layout/StackPane.html" rel="nofollow noreferrer">StackPane</a> you were using will by default centre everything in the centre of the StackPane, which won't be what you want.</p> <p>Instead of a StackPane, use a plain <a href="http://docs.oracle.com/javafx/2/api/javafx/scene/layout/Pane.html" rel="nofollow noreferrer">Pane</a> (if you need to CSS style the pane or have controls in the Pane resize when you resize the Pane), otherwise, use a <a href="http://docs.oracle.com/javafx/2/api/javafx/scene/Group.html" rel="nofollow noreferrer">Group</a>. As you state that the map you are drawing doesn't need to be resized dynamically, then perhaps just a Group is fine.</p> <p>The order in which items are placed inside the group or pane's children list will determine the order in which items are rendered. Items added first to the list will be rendered first and items added last to the list will be rendered on top of the items added first. So you add Street lines to your Pane or Group first, and then add <a href="http://docs.oracle.com/javafx/2/api/javafx/scene/text/Text.html" rel="nofollow noreferrer">Text</a> (or <a href="http://docs.oracle.com/javafx/2/api/javafx/scene/control/Label.html" rel="nofollow noreferrer">Labels</a>) on top of the streets.</p> <p>Another option is to use a direct draw <a href="http://docs.oracle.com/javafx/2/api/javafx/scene/canvas/Canvas.html" rel="nofollow noreferrer">Canvas</a>, but, for your application, using scene graph objects in a Pane or Group is probably a better approach.</p> <p>Use either one Pane/Group with all of the streets added first, followed by all of the names or one Pane/Group for all streets and another for all street names. Separate panes might be nice because you could toggle visibility on the street names as needed by setting a visible flag on the street name group. Don't use one group for both a street and its name, then try to layer multiple street+streetname groups on top of each other, otherwise at the intersections some of the street names will be obscured by streets running on the top of them.</p> <blockquote> <p>when I draw a line I can specify position x,y, but I can't set position of Text or Label... or can I?</p> </blockquote> <p>In addition to positioning lines by providing coordinates to them at line creation, you also need to position the text so that it will be displayed on top of the lines. You can use the <a href="http://docs.oracle.com/javafx/2/api/javafx/scene/Node.html#relocate%28double,%20double%29" rel="nofollow noreferrer">text.relocate(x, y)</a> method to locate the text at a given location.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload