Clarification of positioning best practices
868609Jun 26 2011 — edited Jul 4 2011Hi guys
I have been looking over the different ways to position objects and seen a variety of techniques used..
I would really like to start a conversation to clarify how to do somethings:
To give a bit of background on my situation. I am using a BorderLayout and want to be able to allow users to drag an imageView from the right pane to the center pane. I want to know what is the best way to use positioning functions.
A lot of examples use setLayoutX(x) to position - but in the API doco it indicates that
"Defines the x coordinate of the translation that is added to this @@code Node's transform for the purpose of layout."
So my understanding is that this is how to set the layout offset on the X axis. But that this should not be used for actually positioning nodes?
So I was thinking that perhaps setTranslate(x) was the right thing to use for the specific positioning of the Node within the center region.
I have been looking at say this example by Narayan which uses things a bit differently - is this correct?
http://blog.ngopal.com.np/?p=791
I was looking at the API doco and it indicates that you should use 'relocate' instead of setLayout
"Sets the node's layoutX and layoutY translation properties in order to relocate this node to the x,y location in the parent.
This method does not alter translateX or translateY, which if also set will be added to layoutX and layoutY, adjusting the final location by corresponding amounts."
Can I get someone to comment on this please?