Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Trouble getting icons to change size with window resize?  RSS feed

 
Louis Lewis
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I'm using a jpanel with an 8 by 8 grid layout of jlabels to which I'm adding images to represent a chess board. At first, I was using the ImageIcon class to initialize my icons, but as soon as I added these icons to the labels, the labels no longer changed size with the window (which I want to happen). Someone suggested to me to use this custom stretch icon class, found here:

http://www.camick.com/java/source/StretchIcon.java

So I copied in the class, and initialized a different set of icons using the stretch icon class (specifically, the method that allows you to initialize a stretch icon from a filename), however, when I use these stretch icons, the result is the same. Is something wrong with the class, or with my implimentation of it, and how would I fix this?
 
Rob Camick
Ranch Hand
Posts: 2754
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is something wrong with the class


No

or with my implimentation of it


That would be my guess

and how would I fix this?


We are not mind readers. We have no idea what your code looks like.

As I suggested in your last question, the problem would be the layout manager is the labels are not resizing. Post your SSCCE that demonstrates the problem.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!