aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes graph 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
Reply locked New topic
Author

graph

shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
can anyone say me how to draw a graph by getting x,y co-ordinates(not by calculating the co-ordinates) in applet with scrollpane.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39435
    
  28
You will have to get yourself a Component you can actually draw on. You can't draw on a JScrollPane, but you can put something like a JPanel on it. You can draw on a JPanel with the usual methods, paintComponent() and Graphics.drawPolyLine().
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

Override getPreferredSize() to return the size you want so it will scroll, because otherwise it will never scroll without any components on it.

Basically returning the most bottom-right point of the drawing would be good.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39435
    
  28
Please don't ask the same question twice.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: graph