Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

What is top-left visible point of panel???  RSS feed

 
Prosenjit Banerjee
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have added a JPanel in a JFrame. Whenever I want to draw a text at the (0, 0) position it gets hidden by the Title bar of the frame. What is the best method of finding out the top left visible point of a JPanel?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is (0,0)
the problem is the bottom left of the text is at (0,0), so you would need to
find the height of the text, and adjust the y coord.

simple demo showing the line drawn at y coord 40
text drawn also at y coord 40, but appears above the line

 
Prosenjit Banerjee
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very very very much Michael. You are an excellent person. Hats off to you!
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!