File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes change pixel value to cell coordinate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "change pixel value to cell coordinate" Watch "change pixel value to cell coordinate" New topic
Author

change pixel value to cell coordinate

alona ariel
Ranch Hand

Joined: Sep 09, 2008
Posts: 36
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

Joined: Sep 28, 2010
Posts: 151
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: change pixel value to cell coordinate