IntelliJ Java IDE
The moose likes Swing / AWT / SWT / JFace and the fly likes JScrollPane and JLabel Challenge Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT / JFace
Reply Bookmark "JScrollPane and JLabel Challenge" Watch "JScrollPane and JLabel Challenge" New topic
Author

JScrollPane and JLabel Challenge

Gregg Bolinger
Sheriff

Joined: Jul 11, 2001
Posts: 15040

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


My Blog | DZone Articles
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
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
Sheriff

Joined: Jul 11, 2001
Posts: 15040

Ok, so
here is some code snipit

does that look right?
------------------
Happy Coding,
Gregg Bolinger
Gregg Bolinger
Sheriff

Joined: Jul 11, 2001
Posts: 15040

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
 
IntelliJ Java IDE
 
subject: JScrollPane and JLabel Challenge
 
Threads others viewed
Dieing
WEB-INF
What do you suggest ?
A thread of it's own for Sam's great news
Cheating at chess, how?
MyEclipse, The Clear Choice