Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem on Drawing line  RSS feed

 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

i want to draw a line on the Mouse Dragg event like line component in paint.

its drawing but i taking some shift from the mouse pointer and the line which is drawing.

Please help to fix this.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Please help to fix this.

works fine for me.
 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have handler for the frame. but i have to draw on the panel. so the values (x1,y1) (x2,y2) it is taking for the frame which is from 0,0 but my panel in side the frame.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) add the handler to the panel, or
2) deduct frame insets.top and frame insets.left, or
3) post your code (not the whole code, just a simple, compilable version that shows the problem)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!