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

HELP !!!!!!!!!!!!!!!!!!!!! JSCROLLPANE  RSS feed

 
monojit choudhury
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
How to restrict a canvas within a jScrollPane?
I mean, I am adding a canvas to a JscrollPane.I keep on increasing the size of the canvas, during runtime but the canvas overlaps the scrollPane and goes beyond that, which i dont want to happen.
All i need is how to make the canvas browseable, no matter how big it is, from within the scrollPane using the scrollBars??
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Monojit,
If I understand you correctly, then you are trying to mix a "heavyweight" component (namely "java.awt.Canvas") with a "lightweight" compnent ("java.swing.JScrollPane"). I assume that you are therefore unaware of the problems involved when mixing "heavy" and "light" components together. So I also assume that you haven't read this article (which may be of help to you):
http://java.sun.com/products/jfc/tsc/articles/mixing/index.html
By the way, you can draw directly onto most swing components. If you just want a drawing surface, you may like to try using either a "JLabel" or a "JPanel".
In chapter 4 of Kim Topley's book "Core Java Foundation Classes", he develops a simple java drawing program:
http://vig.prenhall.com/catalog/academic/product/0,4096,013090581X,00.html
Hope this helps.
Good Luck,
Avi.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!