Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

resizing an image using swing

 
jeevansai jinne
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was designing a gui but i was getting error:sun.awt.image.ToolkitImage cannot be cast to javax.swing.Icon when resizing i tried many methods on internet but none worked . Can someone give an example code on how to solve the problem
 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you resizing an icon or the actual image?

Have a look at here for example.

Haven't tried that code on that page but looks workable.
 
jeevansai jinne
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but what is the difference between icon and image , i am resizing png image file by getting image out of ImageIcon . I tried method given in above link even though the code was different same error occurs.Basically i want to resize an image by using only swing without awt methods.
 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jeevansai jinne wrote:but what is the difference between icon and image


Ah the ImageIcon "can be" created using an Image.


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!