Bookmark Topic Watch Topic
  • New Topic

graph

 
shalini gnana
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 49367
62
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 20546
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49367
62
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't ask the same question twice.
 
    Bookmark Topic Watch Topic
  • New Topic