JLabel Icon Update Question

Hi. I have created a jLabel that get's it's Icon updated via a value derived from a MYSQL query. The Icon1 value is a URL. My question is, if I do the MYSQL query and the URL doesn't change from the existing value, does the jLabel still go out and pull the image over? Or does it recognize that the URL is still the same and doesn't make an attempt at pulling the image over? Basically, I am asking this because I'm trying to determine the load on my webserver. Thank you for your help!
image1.setIcon(icon1);

Hi Daryl. Here is what I'm doing:
protected static ImageIcon createImageIcon(String URL,
                                               String description) {
        //java.net.URL imgURL = LabelDemo.class.getResource(URL);
        java.net.URL imgURL = null;
    try {
      imgURL = new java.net.URL(URL);
    } catch (Exception e) {
      //Logger.getLogger(LabelDemo.class.getName()).log(Level.SEVERE, null, ex);
        if (imgURL != null) {
            return new ImageIcon(imgURL, description);
        } else {
            System.err.println("Couldn't find file: " + URL);
            return null;
ImageIcon icon1 = createImageIcon("https://www.website.com/images/" + dateVal + "/thumbs/" + image2Val + "",
                   image1.setIcon(icon1);

Similar Messages

  • JLabel Icon Updates

    I am running a MYSQL query and assigning the values to Jlabels. Like this:
    jLabel2.setText ( nameVal );I want to be able to assign the icons of the jLabels as well. Is this possible?

    Same result. Here is the whole thing right from the tutorials:
    //package components;
    import java.awt.GridLayout;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    import javax.swing.ImageIcon;
    import javax.swing.UIManager;
    import javax.swing.SwingUtilities;
    * LabelDemo.java needs one other file:
    *   images/middle.gif
    public class LabelDemo extends JPanel {
        public LabelDemo() {
            super(new GridLayout(3,1));  //3 rows, 1 column
            JLabel label1, label2, label3;
            ImageIcon icon = createImageIcon("http://duke.kenai.com/iconSized/duke4.gif",
                                             "a pretty but meaningless splat");
            //Create the first label.
            label1 = new JLabel("Image and Text",
                                icon,
                                JLabel.CENTER);
            //Set the position of its text, relative to its icon:
            label1.setVerticalTextPosition(JLabel.BOTTOM);
            label1.setHorizontalTextPosition(JLabel.CENTER);
            //Create the other labels.
            label2 = new JLabel("Text-Only Label");
            label3 = new JLabel(icon);
            //Create tool tips, for the heck of it.
            label1.setToolTipText("A label containing both image and text");
            label2.setToolTipText("A label containing only text");
            label3.setToolTipText("A label containing only an image");
            //Add the labels.
            add(label1);
            add(label2);
            add(label3);
        /** Returns an ImageIcon, or null if the path was invalid. */
        protected static ImageIcon createImageIcon(String URL,
                                                   String description) {
            java.net.URL imgURL = LabelDemo.class.getResource(URL);
            if (imgURL != null) {
                return new ImageIcon(imgURL, description);
            } else {
                System.err.println("Couldn't find file: " + URL);
                return null;
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event dispatch thread.
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("LabelDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Add content to the window.
            frame.add(new LabelDemo());
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event dispatch thread:
            //creating and showing this application's GUI.
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
              //Turn off metal's use of bold fonts
                 UIManager.put("swing.boldMetal", Boolean.FALSE);
              createAndShowGUI();
    }

  • JLabel icon position question

    I want to have a JLabel with text and an icon. I want the text to be positioned on the left and I want the icon on the right. My question is: Is this possible and if so how?

    RTFM
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JLabel.html#setHorizontalTextPosition(int)

  • Dock icons now question marks

    I just got the new iMac today and transfered my data from my old imac to this one via Firewire. Now all my dock icons are question marks. How do I update them?

    I just tried something. I printed a page from my printer; printer icon showed up in dock.  I quickly right clicked on the icon and selected Options/Keep in Dock.  Now my icons are back.

  • Dock icon update current date without having iCal running?

    Hello, minor thing - I typically leave my computer on all the time. I don't use iCal too often but I have the icon in the dock. I am wondering if there is a way to have the dock icon update without launching iCal? It would be nice that the current date is displayed when I view the dock. I guess I could schedule iCal to be launched and then quit once a day. I don't know, any suggestions?

    I have a few suggestions.
    1) This is a free alternative: http://www.objectpark.net/mcc.html
    2) Search MacOSXhints for a way to change the dock date daily. I read a hint there a few months ago for doing this: http://www.macosxhints.com/
    3) Wait for the next iCal as I would be surprised if Apple doesn't build this in to iCal 3 given how many times folks ask this question.
    4) You'll like suggestion #1.

  • Blue icon with question mark instead of image in email

    Sometimes I get a blue icon with question mark instead of image in email, when viewing in Apple Mail Program.
    Does anyone know why?????

    I'm asking your thread get redirected to the proper forum. Please read this tip on how to post on Discussions for future threads:
    http://discussions.apple.com/thread.jspa?threadID=1574700
    Is this issue with Tiger or Leopard? Your profile indicates you have a machine with Tiger, yet your signature of your post says you have Leopard.
    Also, there is no such thing as a Powerbook Pro. Read the text under the screen to tell us exactly which model you have. MacBook Pro is the name given to Macs that are for the pro lineup of notebooks once Apple shifted to the Intel CPU.
    Message was edited by: a brody

  • Hi . i have Intel based iMac. i erased whole hard disk. now it flashes folder icon with question mark... i have no internet or orginal dvd.... i want to clean install any mac osx..friend got mac book pro and osx in dmg format . what are my options?

    hi . i have Intel based iMac. i erased whole hard disk. now it flashes folder icon with question mark... i have no internet or orginal dvd.... i want to clean install any mac osx..friend got mac book pro and osx in dmg format . what are my options?

    On your friend's computer with an internet connection, log into the Mac App Store with your ID and download Yosemite from the Purchases section of the Mac App Store. The make a bootable USB install media using
    http://liondiskmaker.com/
    Then boot from that on your computer and install
    You need an internet connection to install via Recovery mode

  • White screen with flashing file icon with question mark mean

    What does this mean.   We are getting a white screen with flashing file icon with question mark inside the file. 

    It almost certainly means it can't find a bootable volume (one with OS X on it).
    Which means most likely you will have to find your original system installation DVD and install it. Then you should figure out what caused the problem.
    Read this to diagnose it before resorting to reinstalling the OS:
    http://support.apple.com/kb/TS1440
    Excerpt:
    Additional steps
    If your Mac still starts to a flashing question mark, follow the steps below. If any step resolves the issue, you don't need to continue to the next one.
    Select your Mac OS X startup disk with Startup Manager by restarting and holding the Option key. After your Mac starts up, restart again to verify that the flashing question mark does not appear.
    If the issue persists, insert your Mac OS X installation disc. Be sure to either use the disc that came with your Mac, or, if you installed a later Mac OS X version from disc, use the newer disc.
    MacBook Air note: On a MacBook Air, there are two options for starting up from Mac OS X media: Either connect a MacBook Air SuperDrive to the MacBook Air via the USB port and restart the computer, holding down the C key during startup, or use Remote Install Mac OS X to startup from a system software DVD that's located on a partner computer. Once started up from Mac OS X media, skip to step 3.
    Restart the computer, then hold the C key during startup.
    From the Utilities menu, choose Disk Utility. Don't click Continue.
    Select your Mac OS X disk (named "Macintosh HD" by default) in the left side of the Disk Utility window.
    Click the First Aid tab.
    Click Repair Disk to verify and repair any issues with your Mac OS X startup disk.
    After repairing the disk, try to start up normally.
    Important: If Disk Utility finds issues it cannot repair, you may need to back up as much of your data as possible (or use Time Machine to back up to a different disk), then erase the disk and reinstall Mac OS X. You should back up important files and data before erasing a drive. Erasing deletes everything on the hard disk (including things on your desktop). Also, you can install Mac OS X onto an external disk, start from the external disk, and use Migration Assistant to transfer items from your usual internal Mac OS X startup disk to the external disk, then erase the internal disk and reinstall Mac OS X.
    If the issue persists, and Disk Utility didn't find any irreparable issues, quit Disk Utility, quit the Installer, select your disk when prompted, and restart.
    If the issue continues, reset PRAM. Note: After resetting PRAM, if the computer starts up normally, reselect the startup disk in the Startup Disk preferences.
    If none of these steps resolve the issue, start up from the Mac OS X Installation disc and reinstall Mac OS X.

  • Blinking Folder Icon with Question Mark at startup - Is my HD dead?

    I was uploading a .Mov file to my idisk when I got an error message - not sure what it said. But the screen dimmed, and then froze. I held down the power to power down - which it did.
    When I fired it back up, I heard the startup sound - then the screen went white. A gray folder icon appears with a question mark over it - and it blinks.
    I tried powering down again and unplugging, and also powering on with all peripherals unplugged. Again I get the white screen, folder icon and question mark.
    That .Mov was being uploaded as a freelance project for Google due tomorrow morning. Great timing! Am I screwed?
    Thanks!
    Gordon

    I booted from the Mac OS X Install disk and opened the Disk Utility.
    The options for disks to repair are
    1. The Mac OS X Install Disk 1
    2. A drive that's simply labeled "Media."
    Is this "Media" disk my HD? I'm not getting any options to repair the disk.
    Disk Description: Media
    Connection Bus: Serial ATA 2
    Connection Type: Internal
    Total Capacity: 0 Bytes - that doesn't sound good.
    Write Status: Read/Write
    Again, thanks for your help.
    G

  • File icon update crashes finder

    In Panther: I'll have a finder window open in icon mode and I resave a file in Photoshop and when the icon updates the finder window crashes.
    Anything I can do about it other than a work around?

    Have you tried restart and/or Repair Permissions
    george

  • Flashing folder icons with question mark

    After reading through the forums I've found a few discussions and users that have similar problems as me but haven't seen anything that deals directly with my issues.
    After upgrading to Leopard last night, it ran sluggishly for about 15 minutes. I got impatient and decided to restart. While trying to restart it froze, so I just shut my powerbook down. When I tried to boot back up I got the "flashing folder icons with question mark", I've since found out that it isn't finding any type of drive to boot off of. I reset the pram, tried to reboot with the same result. Tried to boot up using cmd-s but still got nothing but flashing folders. Booted up from the Leopard install disc to try and do an archive and install and it said it couldn't upgrade because it couldn't find tiger on my machine. So I booted from the Tiger install discs to try and re-install tiger again. Tiger cant find my HD to install on; I'm thinking this may be due to Leopards install. I ran disk utility and it couldn't complete the verifying process. I got this "Error: The underlying task reported failure on exit."
    After work I'm going to try to boot up in target mode to pull any data i can and try erase my HD and install from there.
    To me it seems like a HD issue. Anyone have any thoughts?
    Thanks in advanced.
    -Chance

    Chank wrote:
    After reading through the forums I've found a few discussions and users that have similar problems as me but haven't seen anything that deals directly with my issues.
    After upgrading to Leopard last night, it ran sluggishly for about 15 minutes. I got impatient and decided to restart.
    The "sluggishness" is perfectly normal. It's well-known and it is not an issue.
    You should have waited for spotlight to finish indexing.
    You may have broken some links by forcing a shutdown while things were still being setup.
    Which install method did you use, upgrade, archive or erase?

  • Can we make things more Useful...? not an update question.

    Ok well i said its not an update question.. well it kinda is.
    today is friday.. the release date of the new iphone 3g.. great.. i love my iphone.. im goin to wait a week or so before i go ahead and buy the new phone for sake of bugs and lil tweaks..
    ok so today i dont know what drove me to update my iphone.. and it got totally bricked for 3 hours.. until i finnally got thru using the "clicking" solution... well i understand the server is overwelmed.. and everyone is updatin and the same time.. but there was a prompt askin if i wanted to update and get the latest iphone software and the latest version of itunes... good.. lets all download it.. most of us it will take 3-6 hours for the iphone to update because the whole problem with the overload on apples side...
    ..BUT...
    what if we cant wait that long?
    i SYNC'd my iphone before the update.. well everyone does... itunes prompts you to do so.. WHY.. emphasizing on WHY... if we synced the phone to our computer systems.. and a problem like for example is goin forth now with this update... CAN'T we just restore our iphones back to how it was before we even tried updating it?
    IT did SAVE to our computers right?
    why cant we just double click here, right click right there..
    and BOOM..
    back for pre 2.0 days.. well until after the storm has passedt..
    why cant we have that option in itunes... heck why not?
    hey doctors will always have beepers to get in contact with.. so hey the whole life death situation thing means it isnt that that THAT bad.. but hey everyone needs there cell phone and people use cell phones.. this one in particular for business.. so maybe we could have avoided some confrontation to some conference calls and clients.. etc... well regardless.. as easy for the update to have made the iphone in a way "bricked".. i think it should have been easy to restore to pre 2.0 .
    windows has that option in its system restore feature...
    download something that messes up your system? virus? update that doesnt work well with the OS?.. restore to an earlier date is an option in the control panel..
    i think itunes need something like that with the iphone version..
    last but not least..
    i love my iphone :-D

    uppers

  • I have one problem with my iphone 4s i c"ant  make facetime calls with other iphons. olso when i make calls on the facetime icon is question sign! can any oane hellp me! wath my be the problem because it is all new iphone!

    i have one problem with my iphone 4s i c"ant  make facetime calls with other iphons. olso when i make calls on the facetime icon is question sign! can any oane hellp me! wath my be the problem because it is all new iphone!

    First question where ae you located?  If you're in the Middle East or UAE, factime has been restricted by the government.
    If your not from there look here:
    http://support.apple.com/kb/TS3367

  • Updated question: Both Mac & PC links possible??

    I apologize right away for posting a new topic with my updated question. But I realized I didn't phrase it right to get any help.
    The question is - is it possible make both Mac links and PC links available on one disk. They would be in separate chapters. (i.e., directing Mac users to this page and Pc to another) Anyone tried this.
    thanks.

    hi jujubes
    I just realised I misled you in my replay to your earlier post due to my poor writing skills
    to clarify:
    I suggest using Intellidisc to create the links for playback on a PC
    you would also use DVD@Access within DVDSP to create the links for Mac playback
    the links will work when played back on both mac and PC from this single disc
    the Intellidisc website gives all this in a tutorial at:
    wwwintellidisc.com

  • Software Update Questions

    Hi everybody,
    I'm still relatively green in the computer world, so, I'm sure these questions are way to "rookie" for you. Nevertheless; here they are.
    Software Update Questions:
    1. What is J2SE 5.0 Release 4, version 4.0 (39.3 MB) and, is it necessary to install?
    2. What is X11 Update 2006, version 1.1.2 (51.0 MB) and, is it necessary to install?
    In case you need to know, I have Mac OS X (10.4.8) with a Verizon FIOS connection.
    Thanks,
    Wayhun
    iMac   Mac OS X (10.4.8)  

    J2SE 5.0 is the latest version of Java. Mac OS X originally ships with Java 1.4 and this gives you the opportunity to upgrade to the latest version.
    It's an optional upgrade since there are many changes between Java 1.4 and java 5, so some people might prefer to hold off until they've verified their Java apps work with the new version. For most people, though, it isn't an issue.
    X11 (also known as XWindows) is a standard GUI interface for Unix systems. If you're using X11 you'd probably alredy know about it and therefore wouldn't be asking this question. It's not going to cause any problems if you update it, but it won't offer any advantage unless you're running X11-based applications.

Maybe you are looking for