It is the job of the layout manager to set size/position of components. If you explicitly set the x, y, width, height, of a component, your changes will be "wiped out" the next time any of the component's parents are revalidated/laid out again.
You can set the preferredSize (`setPreferredH()`, `setPreferredW()`), but these methods are marked deprecated to discourage use as it is better to use a layout manager for this sort of thing. If you can describe a little bit more about what you are trying to do, then I might be able to offer more specific advice. Things to think about: 1. What will happen to the other components in the form when you resize and reposition the component? Do they get moved or shifted at all? 2. Is this a new "permanent" state for the form, or is this just a temporary "highlight" that will be soon removed? 3. Do you want to animate the component on the size change, or just "jump" to a new position? Steve On Mon, Mar 20, 2017 at 5:55 AM, David <[email protected]> wrote: > Hi, > > I would like to change position of a component dynamically (when a button > is pressed or after a period of time). > I tried to use setWidth/height/x/y, but every time the screen is touched > or rotated, the components goes back to its original position (defined on > the layout manager). > > Is it possible to change a component position different to the position > set on layout manager? > > Thanks, > > David > > -- > You received this message because you are subscribed to the Google Groups > "CodenameOne Discussions" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > Visit this group at https://groups.google.com/ > group/codenameone-discussions. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/codenameone-discussions/bdc3f6bc-09c4-4239-ac78- > c862a4a72daa%40googlegroups.com > <https://groups.google.com/d/msgid/codenameone-discussions/bdc3f6bc-09c4-4239-ac78-c862a4a72daa%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Steve Hannah Software Developer Codename One http://www.codenameone.com -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. Visit this group at https://groups.google.com/group/codenameone-discussions. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/CAGOYrKWbnCW%2BKjLLqcfrmyBAsXcWSAzQKh9zhkb%3DM-_BjRBX3Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
