• Post Reply Bookmark Topic Watch Topic
  • New Topic

JScrollPane and JLabel Challenge

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok people, here is a challenge. my screen resolution is 1024x768. I want to create a JLabel 2000x2000 and be able to scroll around the JLabel. Also, I would like for the view to start out relatively close to the center of the JLabel.
Any suggestions??
Thanks

------------------
Happy Coding,
Gregg Bolinger
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will need to use setMinimumSize() setPreferredSize() and put the Dimension you want in it. That will give you a large label. Are you putting it on a JScrollPane?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, so
here is some code snipit

does that look right?
------------------
Happy Coding,
Gregg Bolinger
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the code to work, and I can see the scrollPanes, but you can't scroll through the entire JLabel.
Any ideas?
------------------
Happy Coding,
Gregg Bolinger
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!