• 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

BufferedImage to Icon - have I done this in the correct way?

 
Ranch Hand
Posts: 49
Netbeans IDE PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, forumsts!

I have had big problem width image handling in java. I am having a project where i must create
thumbnail images in JButton objects and when the user click on theese buttons a maximized
undecorated frame is opened and displays a larger variant of the selected image / images.
I have rendered the thumbnail images to icons for the button objects using the getScaledInstance
method in the Image class. But i am still unsure of if i have the grip on this operation or not.
I first assign a thumbnail image to a label in large frame and in an filterIcon method i convert
the image from that icon label to an object using the BufferedImage class and create a larger
icon image for my label object. I must also consider the size of the selected image to that part
that i dont want to display images that are smaller than the width of 800 pixels to be displayed
all over the screen but half of that size. Images that are larger than 800 will be displayed over
the screen with their defalt sizes. I have the code below ...







I just need some hints or tips how to do this correct i am a rookie and i know i must have missed out a lot.
I have read some articles on the subjects in question but i am still unsure. I hope i have been clear enough
in my description of the problem in this post.

Best regards,
Krillian.
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
one way to look at it is "if it works it is correct"
as far as style, i am no expert, and i only skimmed through your code, but it looks pretty good in general
 
krillian konstatos
Ranch Hand
Posts: 49
Netbeans IDE PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Randall Twede wrote:one way to look at it is "if it works it is correct"
as far as style, i am no expert, and i only skimmed through your code, but it looks pretty good in general



Thank you so much for your reply and it works fine for the project in question and thank you so much for your
compliment on the style. It sheared me up a little after a lot of struggling with java's graphic handling
packages and thumbnail image processing.

/krillian.
 
Space pants. 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