This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

question about positioning a component (GUI)  RSS feed

 
mike ryan
Ranch Hand
Posts: 210
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I know this is not the GUI forum but i believe this question fits better in the beginning forum(I think;) )

I have created a GUI that moves it's position when one of the buttons is pushed ("R" right ,"L" left, "U"up ,and "D" down).

My first try was written like this




using the currentPositionh and currentPositionW , when the component was dragged and then clicked, it would go back to the last position the component was clicked to. instead of
starting from the current position on the screen where it was dragged to.


however while trying to figure out how to fix the problem i tried this:




Using the getX() and getY() directly in the if statement, the window got it's actual "current position" and started from there, and no longer jumped back to the last position it was formerly clicked to.

can someone explain to me why that is?


WAIT! i lied, it no longer jumps back BUT it doesn't go right left up and down but diagonal and not UP at all?? guess i need to work on it some more (SORRY).

Thanks
Mike
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!