Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+4 votes

I am able to move the button based off left, right and center but what method would I use to move the button to specific coordinates?

asked in CSC305 Fall 2019 by (1 point)

1 Answer

0 votes

The best way I found how to do this is using the .setTranslateX() and .setTranslateY(). The number of pixels is passed as the parameters. I called my button "button" (because it's obvious), so in my code I typed

button.setTranslateX(150);
button.setTranslateY(60);

This puts the button in the center, top half of the window.
I know this question was asked 6 days ago when this answer appears, but I hope it helps!

answered by (1 point)
...