Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javafx 2, layoutx / layouty values

 
Roger Wegner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem to find out the correct layoutx / layouty values for shapes. Please have a look at this example:

If I run this program the line seems to be positioned as expected starting at 10, 10. However the layoutx and layouty values are 0, 0.

Can anybody give me an explanation for this behaviour and / or tell me how to find out the actual position?

Thank you,
Roger
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see that your are using Line from a different package. You should be using: javafx.scene.shape.Line
 
Roger Wegner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohamed Sanaulla wrote:I see that your are using Line from a different package. You should be using: javafx.scene.shape.Line


You are right, I messed this up (copy / paste) when I created the sample. However, the behaviour is exactly the same with javafx.scene.shape.Line.
I corrected the sample.
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are setting the startX and startY and not exactly the layoutX and layoutY which are properties of the node. So layoutX and layoutY are 0.0.
 
Roger Wegner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohamed Sanaulla wrote:You are setting the startX and startY and not exactly the layoutX and layoutY which are properties of the node. So layoutX and layoutY are 0.0.


I see, is there any mapping from layoutXY to startXY and vice versa? Where can I read and learn about the relation between them?
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roger Wegner wrote:
Mohamed Sanaulla wrote:You are setting the startX and startY and not exactly the layoutX and layoutY which are properties of the node. So layoutX and layoutY are 0.0.


I see, is there any mapping from layoutXY to startXY and vice versa? Where can I read and learn about the relation between them?


You can use the API documentation http://download.oracle.com/javafx/2.0/api/index.html
Alternatively you can try setting the layoutX and layoutY of the line.
startX and startY are the properties specific to the Line, but as you can see in the API layoutX and layoutY are the properties of Node and are inherited by all the components.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic