• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

scrollable paint component

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your help, guys!

The link that Dawei Li posted finally helped me to figure things out.
 
Straws are for suckers. Now suck on this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic