• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Scrolling an extension of JLabel doesn't work :s

 
Ranch Hand
Posts: 176
Mac Chrome Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy folks,

I'm having a lot of trouble getting a custom JComponent to scroll inside a JScollPane. I can only scroll if the mouse pointer is over the scroll bars, when I move the pointer into the JViewport (or whatever it's called) I can no longer scroll.

I've launched the 1st demo on the How to Use Scroll Panes pages and obviously it does what you'd expect. I noticed that this example uses an extension of JLabel (called ScrollablePicture). I've also noticed that this example still works if the ScrollablePicture class doesn't implement Scrollable and MouseMotionListener.

So I decided to do something similar to that but my program persistently refuses to work





Any pointers would be much appreciated.

Thank-you
 
Olivier Legat
Ranch Hand
Posts: 176
Mac Chrome Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found a work-around (with a little bit of help). It's not particularly tidy but it works:

 
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic