Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

scrollable paint component  RSS feed

 
Marc Beck
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I make a paintComponent scrollable? I found some example code about how to make a picture scrollable, but I failed to modify the code to make it work for a paintComponent.
 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marc Beck:
How do I make a paintComponent scrollable? I found some example code about how to make a picture scrollable, but I failed to modify the code to make it work for a paintComponent.


from Java Notes by Fred Swartz MIT License

Who calls paintComponent ?
When you subclass JComponent or JPanel to draw graphics, override the paintComponent() method. This method is called because the user did something with the user interface that required redrawing, or your code has explicitly requested that it be redrawn.


Therefore your posted question requires clarification.
 
Dawei Li
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You question is Drawing a scrollable image?
http://forum.java.sun.com/thread.jspa?threadID=578604&messageID=2911929
I think this is similar as your question.
maybe help you
[ July 03, 2007: Message edited by: Dawei Li ]
 
Marc Beck
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Who calls paintComponent ?


paintComponont is called by MapPanel, a class that extends JPanel and implements Scrollable, MouseListener, and MouseMotionListener
 
Marc Beck
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your help, guys!

The link that Dawei Li posted finally helped me to figure things out.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!