Note that there are some explanatory texts on larger screens.

plurals
  1. POjavafx drawing lines and text
    primarykey
    data
    text
    <p>I've got a problem with drawing lines in JavaFx. We're making an application simulating traffic - there are 16 streets, and every street has a different color dependent on traffic. There is a very simple picture: <a href="http://img546.imageshack.us/img546/9949/uliceu.jpg" rel="nofollow">http://img546.imageshack.us/img546/9949/uliceu.jpg</a></p> <p>My first idea on how to do this was to draw streets as lines and simply change its colors. But I cant put a text on the line (I want a text with a street name). So I tried to put a line and a text on the StackPane. Then I added that StackPanes on BorderPane center... But it didnt work. Seems like StackPane doesn't respect line's start x, start y... The lines overlapped each other.</p> <p>Main pane of the app is BorderPane and I want to put a map on center. It doesn't need to be resized dynamically, we have only one map so It can be positioned in static way. </p> <p>I need something like that: <a href="http://img834.imageshack.us/img834/1157/ulicac.jpg" rel="nofollow">http://img834.imageshack.us/img834/1157/ulicac.jpg</a> But streets need to connect to each other... like on the first picture</p> <p>Have you any suggestions on how to do that? Any tips would be appreciated :)</p> <p>Like that:</p> <pre><code>Group gr = new Group(); Text text = new Text("1st Street"); text.setFill(Color.web("fabbff")); Line line = new Line(0, 150, 200,150); line.setStrokeWidth(20); line.setStroke(Color.web("000000")); gr.getChildren().addAll(line, text); group.getChildren().addAll(gr, //and every other street); </code></pre>
    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. 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