Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

change pixel value to cell coordinate

 
alona ariel
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I change the pixel value to normall cell coordinate?

int xpos
int ypos

public void mouseClicked (MouseEvent me) {


xpos = me.getX();
ypos = me.getY();




}



public void paint(Graphics g)
{


g.drawString("("+xpos+","+ypos+")",xpos,ypos);
g.drawLine(xpos, ypos, x, y);

g.setColor(Color.blue);
g.drawString("("+xpos1+","+ypos1+")",xpos1,ypos1);
g.drawLine(xpos1, ypos1, x, y);




}
 
Kevin Workman
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alona ariel wrote:How can I change the pixel value to normall cell coordinate?


Cell coordinate of what? A JTable? A grid you have come up with yourself? A List? A Tree?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic