Whats the best way to manage/display images ?

I'm building a yet another photo management application that is designed to be a Picasa2 "lite". I've got a lot of JPGs I need to manage, all of which are loaded asynchronously and cached over the web.
The same image may appear in multiple places, (i.e. thumbnail, fullsize, original with a zoom box, etc.) I'm having problems keeping all these images in synch when I change the underlying image -- right now I have to create all new JLabels for everything and add them to their respective Panels again. But that doesn't seem like its the best way.
Here's my JLabel sub-class:
public class ImageLocatorSubscriber extends JLabel {
     public final ImageDimEnum maxDimEnum;
     final ImageIcon imgIcon = new ImageIcon();
     BufferedImage bi;
     ImageLocator il;
     public ImageLocatorSubscriber(ImageLocator il, ImageDimEnum d) {
          super();
          this.maxDimEnum = d;
          this.imgIcon = new ImageIcon();
          if (il != null) {
               this.il = il;
                        this.bi = il.getBi(RunMode.NOWAIT);
                  if (bi.getWidth()!=maxDimEnum.dim.getWidth() || bi.getHeight()!=maxDimEnum.dim.getHeight()) {
                       bi = FotoFix.resize(bi, maxDimEnum.dim);
                  this.bi = bi;
                  this.imgIcon.setImage(this.bi);
                  this.setSize(bi.getWidth(), bi.getHeight());
          this.setIcon(this.imgIcon);
          this.setBorder(Constants.borderGray);
     }Is the preferred method for changing the image displayed in a JLabel
a) create a new ImageIcon and use (JLabel) this.setIcon()
b) reuse the existing ImageIcon and use (JLabel) this.imgIcon.setImage();
c) remove the old JLabel from the panel, create a new JLabel, and add that to the panel?
I can only get c) to work. When I try to use b) some of the images are not updated properly, even as I have declared this.imgIcon as final. Any ideas, or should I just leave it be?

override this method in any JComponent subclass
http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html#paintComponent(java.awt.Graphics)

Similar Messages

  • Whats the best way to manage 100s of thumbnails?

    I'm trying to build a simple photo management app in java, like Picasa2. I want to be able to scroll through 100s of thumbnails. Whats the best way to manage them from a memory standpoint?
    a) can I load up 100s of thumbnails into a JScrollPane? If so, will it do anything special to manage memory for the thumbnails that are offscreen?
    b) should I just draw up a grid of JLabels and page through them like you would in html?
    Is there another approach? Is there any special way to manage the thumbnails that are offscreen (besides loading them all in memory ) and still get a fast response time?
    BTW, if anyone wants to join me in this project, I'm happy to opensource and share.

    Because for some of us, it takes a lot longer than 5 mins. Besides, I was on someone else's computer.
    Regardless, I've implemented JList for images, and it works really well. For those of you who are following in my footsteps, the answer is:
    JList renders ImageIcons by default.
    If you want to render a JLabel with an ImageIcon set to an image, you need to write a custom ListCellRenderer, but it turns out that is not too hard. But here is a follow-up problem:
    My app has JLabels that subscribe to an ImageLoader that loads images in the background. On init() the JLabel just has the ImageIcon set to a placeholder image:
              myJLabel.imgIcon = new ImageIcon();
              myJLabel.imgIcon.setImage( myPlaceholderImage );
    However, once the actual image is loaded, I call a refresh method to set the ImageIcon to a new image:
              myJLabel.imgIcon.setImage( myLoadedBufferedImage );
    My problem is getting the JList to render the updated JLabel. Right now, I keep a reference to the JList with myJLabel and call revalidate() on refresh, but that doesn't seem very clean.
    Is there an easy/natural place to get the JList to revalidate()?
    Can I easily know which JLabels are in the viewport of the JList scrollpane? That way I could revalidate only the visible JLabels or when scrolling.

  • Whats the best way to place an image in DW CS5.5

    Hello all,
    what is the best way to place an image exactly where I would like it to go in Dreamweaver CS5.5?
    I have my images sliced in Fireworks already. Also since my images are sliced already in Fireworks is
    there a way to place the images exaclty where I had them in my original Photoshop file?
    Thanks in advance!
    DRivera

    Stay away from APDivs for layouts.  Start with a pre-built CSS layout that has all the columns you will need for your project.
    Beginner CSS Templates -
    For commercial CSS Templates that are rock solid and perform well in all browsers, visit Project Seven:
    http://www.projectseven.com/products/index.htm
    Not Just a Grid CSS Framework (free)
    http://www.notjustagrid.com/demo.asp
    Ultimate Multi-Column Layouts (free)
    http://matthewjamestaylor.com/blog/ultimate-multi-column-liquid-layouts-em-and-pixel-width s
    EZ-CSS Templates (watch the screencast to see how it works)
    http://www.ez-css.org/css_templates
    Dreamweaver CSS Templates for beginners (free)
    http://www.adobe.com/devnet/dreamweaver/articles/dreamweaver_custom_templates.html
    New DW Starter Pages (free)
    http://www.adobe.com/devnet/dreamweaver/articles/introducing_new_css_layouts.html
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • Whats the best way of storring images

    I have an application that will handle images for the elements of a catalog. The application will not have a very heavy load, will be for managament use only, and the database and the app server will be on the same machine.
    I am investigating what is the best way of storing these images, if i keep them in the database or in the server as files.
    With best way i mean perfomance and quick response.
    Whats your experience with this topic?
    Thanks

    I would store them on the server and not in the database as e.g. ORDImage objects (InterMedia). Last approach is more complex. You have to retrieve them from the database and if you use ORM the framework needs to support this type of object. If you store the images on an Oracle AS they can still be cached.
    Ronald

  • What is the best way to manage multiple devices with one iMac - different users with seperate itunes accounts or one mac user with different itune logons and libraries?

    Hello
    I have just purchased an imac which I am very happy with.  In our household we also have two iphones (one mine and one husbands) and one ipod (my sons). We all have individual itunes accounts set up on our previous computer (not a mac). We have sepereate apps and music, although there may be the odd occasion where we would like to share a song (if this is possible) across devices.
    I am just wondering the best way to manage these devices using the new imac.  Should I create individual accounts to logon to the imac, then from within these launch our own itunes accounts and sync our devices with these.  Or should I be using one version of itunes, logging on to this with our different itunes usernames and storing things in libraries.
    Any help would be greatly appreciated. 
    Thanks

    I am presuming that we cannot share downloaded apps and music between accounts because of the copyright issue,
    Though I'm no copyright lawyer, as long as it's within a household, you can share content among users. Such sharing is, absent specific language preventing it not present in the iTunes Store terms of use, generally considered to be "personal use". So you can share apps and music amongst your users on your computer and with their devices. You just can't give any of that content to friends or relatives who don't live with you.
    What I am not clear on, it making sure that this appears in each itunes account - is it easy to find the file storage folders that match the itunes accounts and what would these be?
    The iTunes library and files are by default in a user's Home/Music folder. But you don't have to find the folder; in fact putting a file into the folder yourself won't add the file to iTunes. Just drag the file into the iTunes window. iTunes will copy it to the correct location.
    Regards.

  • What's the best way to manage Apple IDs for multiple devices?

    Hi,
    We have
    a shared Macbook air
    a shared iPad
    my iPhone
    his iPhone
    We want to put one ID on the Macbook and iPad that we can use to have the same iMessage on both and that we can put a card on and use in the iTunes store etc.
    We also want to have our own iMessages on our iPhones, plus be able to use the account with the cards on them to purchase and share across devices...
    What's the best way to manage them all?

    Welcome to the Apple Community.
    iTunes is straight forward, just use the same ID on all of them.
    What exactly do you want to see in messages on the Mac and iPad, messages combined from each of your phones or a different account just for both of you.
    You should think about what you want in calendars, contacts etc, on your shared devices.

  • What is the best way to manage photos - Dropbox (with sync), Facebook (with sync), iPhoto, etc.?

    With so many cloud based and wireless syncing services, I'm lost as to the simplest way to keep photos sync'd as well as backed up. My dropbox is currently syncing all photos I take with my iphone, but in an overall folder called CAMERA UPLOADS, so they are uncategorized. I upload pics to facebook, which facebook also has a sync photos feature, but I don't necessarily want all photos uploaded to facebook. What has worked best for everyone so that there aren't a ton of dupicate photos everywhere, and multiple syncs of the same photos?
    Also, what is the best way to manage my iPhone photos generally? I'm never sure if I delete a photo from my phone, does it delete it on my computer via iCloud? Sometimes I just take a picture to send to a friend that I don't need to keep, while others are ones I want to sync to my computer. Can I control when deleting that it be deleted everywhere or just on the device? And alternately, can I choose certain photos not to sync via iCloud?
    iCloud makes me nervous. Once when I wanted to place all photos of my pup into a folder, I selected the photos on my iPhone and accidentally clicked delete instead of move. No big deal, I figured they'd be at home sync'd on the cloud. But since I'd deleted them on my phone, the cloud deleted them on my home computer too and the photos were lost.

    I am presuming that we cannot share downloaded apps and music between accounts because of the copyright issue,
    Though I'm no copyright lawyer, as long as it's within a household, you can share content among users. Such sharing is, absent specific language preventing it not present in the iTunes Store terms of use, generally considered to be "personal use". So you can share apps and music amongst your users on your computer and with their devices. You just can't give any of that content to friends or relatives who don't live with you.
    What I am not clear on, it making sure that this appears in each itunes account - is it easy to find the file storage folders that match the itunes accounts and what would these be?
    The iTunes library and files are by default in a user's Home/Music folder. But you don't have to find the folder; in fact putting a file into the folder yourself won't add the file to iTunes. Just drag the file into the iTunes window. iTunes will copy it to the correct location.
    Regards.

  • What is the best way to manage my iPhoto, which is taking up too much space on my MacBook Pro?

    What is the best way to manage my iPhoto, which is taking up too much space on my MacBook Pro?
    Specifically, I'd like to keep some of my favorite pictures on the laptop while moving the rest to an external hard drive. Is there a way to tag just a few pictures inside an event/album as "favorite", while storing the rest in an EHD, but still keep them connected to the same event/album? I'd like to have just the favorite pictures on the laptop, but when I have the EHD connected,  be able to view all my pictures in the same place, and not have to browse through separate hard drives. Ideally, whether or not a picture is designated as "favorite" will determine where it resides.
    Is this at all possible?
    I have only 7 GB left on my HD and I'm desperately needing a solution!
    Thanks!

    You need two libraries to do this. One on the external with all your Photos. One on the internal with a subset - your favourites. You do it this way to make backing up easier - that is, back up the library with everything, so you're only backing up one.
    Make sure the drive is formatted Mac OS Extended (Journaled)
    1. Quit iPhoto
    2. Copy the iPhoto Library from your Pictures Folder to the External Disk.
    Now you have two full versions of the Library.
    3. On the Internal library, trash the Events/albums/photos you don't want there
    Now you have a full copy of the Library on the External and a smaller subset on the Internal
    Some Notes:
    As a general rule: when deleting photos do them in batches of about 100 at a time. iPhoto can baulk at trashing large numbers at one go.
    You can choose which Library to open: Hold down the option (or alt) key key and launch iPhoto. From the resulting menu select 'Choose Library'
    You can keep the Library on the external updated with new imports using iPhoto Library Manager

  • What is the best way to manage multiple ipods using the same itunes?

    Hi Everyone
    i am trying to manage three different ipods through the one Itunes, all with very different tastes, not sure if I am doing it the best or easiest way so does anybody have a simple solution on what you're supposed to do, to keep it all simple!
    Cheers
    Liv

    If you have created a new Windows user account you need to log out and then log back in with your original user name. By default each Windows profile will have an independent iTunes library.
    If instead you managed to create a new library within the same profile. click the icon to start iTunes and immediately press and hold down the shift key, keep holding until asked to create or choose a library. Click Choose and navigte back to your original which should be at <User's Music>\iTunes.
    Your question as posed was:
    What is the best way to manage multiple iPods using the same iTunes {library}?
    in which case Selected Playlists is probably the best approach. Simply create a playlist for each device, Alice's iPod, Bob's iPhone etc. and sync the device with the appropriate list.
    tt2

  • What is the best way to manage 5 users and 6 devices? We dont all want the same merged contacts, we dont all want the same calendar notes, music, pics etc etc.

    What is the best way to manage 5 users and 6 devices? We dont all want the same merged contacts, we dont all want the same calendar notes, music, pics etc etc.

    As long as it is pointed to iTunes it will be accessible via home sharing on Apple TV.
    http://support.apple.com/kb/HT1751?viewlocale=en_US&locale=en_US
    If these are commercial DVD's we can't comment on any conversion process.

  • What is the best way to manage photo's with multiple login accounts?

    There are three people in my household and each has their own login into the computer. I also have and external drive.  Space is becoming short on the computer, so I want to move all my photos and music to the external drive.  I have moved all the music files and folders to the external drive and then each user has just updated their individual iTunes folders, pointing to the external drive.
    However, what is the best way to manage photo's? Do I do this same process or is there another way? I don't want any music or photo files on the computer's hard drive at all if it can be avoided.

    I am presuming that we cannot share downloaded apps and music between accounts because of the copyright issue,
    Though I'm no copyright lawyer, as long as it's within a household, you can share content among users. Such sharing is, absent specific language preventing it not present in the iTunes Store terms of use, generally considered to be "personal use". So you can share apps and music amongst your users on your computer and with their devices. You just can't give any of that content to friends or relatives who don't live with you.
    What I am not clear on, it making sure that this appears in each itunes account - is it easy to find the file storage folders that match the itunes accounts and what would these be?
    The iTunes library and files are by default in a user's Home/Music folder. But you don't have to find the folder; in fact putting a file into the folder yourself won't add the file to iTunes. Just drag the file into the iTunes window. iTunes will copy it to the correct location.
    Regards.

  • What is the best way to manage the file space given how much GB the video clips use up?

    I just downloaded a years worth of video off my HD camera.  I took up 125 GB on my hard drive.  What is the best way to manage this content going forward as there will be a lot more video to come in future years with small children!

    rule of thumb:
    SDef ~13GBs/h
    HDef ~30-40GBs/h ...
    latest investment of mine:
    ext.HDD, usb2 (=I have no trouble using usb2 for editing my short projects), 1.5TB=70€  ...
    ... which adds to ~4.2TB for my hobby, incl. back-up drives ...

  • What is the best way to manage tabIndex

    Hallo. I am trying to understand what is the best way to manage the taborder inside flex. If, in my application there are several account and thus several states (1 for each account) i can prepare my states so that some components are visible and some not.. The problem is that, for each state the taborder can change even if the objects are the same.. What is the best way to manage tabIndex relatively to the different states in which the objects are?
    Thx
    Max

    I liked tab order very much (top to bottom, left to right) ..but because of the problem i had and you answered here: 
    http://forums.adobe.com/thread/971994?tstart=0
    I cannot use tab order because, in that group that focus goes from object n to 1 and the only way to solve the issue is to set tabIndex manually.. Is there another way??..  It seems like tabIndex setted manually has precedence on native taborder so i think i have to manage all the state with manual tabIndex isnt'it??.. Or maybe ia have another way?
    Thx for the answer
    Max

  • What is the best way to manage tasks?  I have moved from outlook and only have mail and ical

    What is the best way to manage tasks.  I have moved from a pc with outlook and have lost 'tasks' in that programme.  Do I have to rely on ical or can I download an app to manage business tasks?

    iCal does have reminders but its implementation of tasks is pretty wimpy. There are a number of programs that are better geared to the job. I was a level 4 procrastinator until I discovered Getting Things Done and for me Things is perfect. It lets me handle projects which are dependent upon multiple tasks in a no-nonsense easy fashion. Much less expensive and really not much more than a list maker is Wunderlist. Thankfully there's a ton of shareware offerings - check out MacUpdate.com and see what works for you.

  • The best way to manage multiple iPhones

    Hi,
    We currently own three iPhones, my wife’s, my daughter’s and mine and we are all using basically the same apple ID which is good for purchased apps since I have to buy it once and they automatically show on all devices, the issue is with free and personal apps, all of my daughter’s games end up in the other two phones which is annoying.
    What would be the best way to manage all three iPhones butstill be able to share purchased apps without adding unwanted apps?
    Do I need to create three different accounts?
    What would you guys recommend?
    Thanks a lot!

    We have now 5 devices, two adults and 3 kids, including a new work iPhone. To manually select apps from scratch per device/per sync is really tedious.
    Can't one save the "last checked" selections per device, so when Device B is connected the profile pulls up Device B's selections, and I could then evaluate if there are any minimal modifications to be made?
    On the same note, are each device's personal phone items (settings, speed dials, etc) automatically saved separately per device?

Maybe you are looking for

  • MRKO posting to invoice issuer.

    We have a scenario in consignment where the vendor is not created in the company code. The vendor doesn't have FI data so when the MRKO is processed to settle, the system get an error the vendor is not defined in the company code XXXX. In this scenar

  • Safari 5.0

    I am running Mac OS X 10.5.8 and I downloaded the system update for Safari 5.0. When I try to open Safari nothing happens, no window, nothing.

  • Can't Un-Check Some Items

    Hi, Is this a bug: I've upgraded to iTunes 7.0.1 and now I find that I can't un-check certain items (that I don't want downloaded to my iPod) by clicking the checkmark. If I select the item, right click then select "unckeck item" it will, in fact, un

  • Can't remove distiller fonts folders...long time for opening distiller...xp

    We have distiller 9.0 in workflow and in font location option is 1000000 font folders. I cant remove it from list and distiller need long tine to open. I try to manualy remove files *.lst (AdobeFnt108.lst....) from \\Application Data\Adobe\Acrobat\Di

  • Utilisatio​n de NI myDAQ pour commander un moteur pas à pas

    salut est-il possible d'utiliser NI myDAQ pour commander un moteur pas à pas sachant que la commande du moteur est réaliser en utilisant labview-solidworks avec le module NI softymotion