JLabel icons update

Hello

I can't update the images defined as icons in a JLabel. I checked the JLabel to change when updateImage() is called - what it does, but the display does not update - the image is just the same as the original that has been loaded image.

Any help would be appreciated... Thank you.


---- some methods and variables omitted ----

public class GraphicInterface extends Reference
{
    private JFrame frame;
    private Container contentPane;
    private JTextPane imageDisplay;
    private JLabel imageLabel;

    public GraphicInterface()
    {
        makeFrame();
    }

    private JLabel loadImage(String fileName)
    {
        JLabel label = new JLabel();
        ImageManager image = new ImageManager(fileName);
        label = image.loadImage();
        return label;
    }
    
    private void updateImage(String fileName)
    {
        imageLabel = loadImage(fileName);
    }

    private void makeFrame()
    {
        frame = new JFrame("GlossarySearch");
        makeMenuBar();
        
        contentPane = frame.getContentPane();
        contentPane.setLayout(new BorderLayout());
        
        makeSearchBar();
        makeDisplay();
        
        frame.pack();
        frame.setSize(600,400);
        frame.setVisible(true);
        
    }

    private void makeDisplay()
    {
        JPanel display = new JPanel();
        display.setLayout(new GridLayout(1,1,5,5));
        contentPane.add(display, BorderLayout.CENTER);
        
        imageLabel = loadImage("default image");
        imageLabel.setBorder(BorderFactory.createTitledBorder("Image"));
        imageLabel.setPreferredSize(new Dimension (200,250));
        display.add(imageLabel);
    }
}

When you say "the JLabel changes" I'm guessing that you mean that the JLabel variable named "imageLabel" was the thing that has changed? That won't change the UI for the original JLabel object reference.

Which is what we need to change. You have a reference to this object in the form of the variable "imageLabel"; to modify the object you call one of its methods, like maybe setIcon() or something... What did your ImageManager class to create the label in the first place.

Tags: Java

Similar Questions

  • regarding the icon updates to windows 7 ultimate for windows 10

    It doesn't show any icon updates to windows 7 ultimate for windows 10. What I would do. I'm really curious

    Download windows 10

    For the official list of things to try if the icon does not appear (you're not alone in this), see this long post - well http://answers.microsoft.com/en-us/windows/forum/windows_10-win_upgrade/i-want-to-reserve-my-free-copy-of-windows-10-but-i/848b5cce-958b-49ae-a132-a999a883265b of the question and the answer marked at least.

    However, icon or not, you will still be able to download the ISO and install it for free, once W10 is released.

  • Sleep function and passing binary icon updated

    Hello

    I'm new to LabWindows/CVI and I have a question which might be very simple to answer.

    When a sleep function is used within a binary switch, how can I get the icon on the main table to update as soon as I click on the switch, rather than change the status that the sleep function is complete?

    In other words, if I have a switch to which I have applied a delay of x seconds (via the sleep function), when I run the program and click on the switch, its status changes after x seconds. Instead, I'd like to change it immediately, and then wait x seconds before the action of the switch to take place...

    I appreciate all help. Thank you!

    Just before calling sleep, add: ProcessDrawEvents();

    JR

  • Marker icon update mapview

    Hey people.

    I got a plan where I add geolocation with the marker icon.

    I want to update this marker of the icon with another icon, but the accident during the click on the marker popup after update.

    Update: I remove the geolocation of the dataprovider, I change icon, finally I add geolocation to dataprovider.

    If I don't remove/add geolocation of dataprovider, mapview is not update the marker icon.

    Thank you.

    OK, I already solve it.

    I don't have removal/addition of marker for the data provider. Just add for update.

    Thank you.

  • Icon update for blackberry app world blackBerry Smartphones

    I have a curve 8520. I have an updated list on my main screen to the world of the ap, I will ito app world and there is NO update, and I ca not get rid of the icon on my main screen it bored seeing her! Please can someone help

    Hello and welcome to the community!

    Access your Messages application... If there is a new message from AW, delete it and the icon should disappear.

    Good luck!

  • vCD miniature VM ICON update - when


    Hello

    I am wanting to know when the icons for the virtual machines that show a thumbnail view of the virtual machine, update with a new image?

    I deleted the browser cache, so it does not appear to be related to the caching of the browser.

    Thank you

    Performance and best practices doco:

    vCloud Director only retrieves the photos if they are requested and once recovered, put them also in cache. The thumbnails are required when a user accesses different pages of the list or the dashboard that displays the virtual machine image.

    Thumbnails are cached by default for 180 seconds and can be adjusted by adding keys in the global.properties file and restarting of the cell.  Refer to the Configuration section of limitations of the performance and best practices - page 23.

  • IOS 9.2.1 icon update App store but no update available

    IPhone 6 IOS 9.2.1 My App store presents an update is necessary, but there is no update. Tried reset with power and "home" button. Forced to leave App store, power off with the home button, no luck. All this experience?

    Try to remove and then reinstall the application that has been recently updated.

  • After the installation of KB2729450, the icon "updates are ready... "appears again and wants to reinstall again and again...

    XP Home, Service Pack 3

    FIXIT ran a few times and that did not help.

    Finally, I did a search for all files and folders with KB2729450 in the name. There were about 8 files in the TEMP folder. I reasoned that the patch has been downloaded, but not applied.

    I have deleted all entries with KB2729450 in the name. I then to Microsoft and downloaded the patch manually. So I ran the patch. The hotfix has been installed and the update notification disappeared.

    Thanks for your reply. Perhaps this fix works for other people with similar problems.

  • Cultures of the homescreen icons update

    I have an icon 32 x 32 pixels of the home screen.  The meat and potatoes of the image is a circular graphic 30 x 30, centered on the image.  All the surrounding pixels are transparent.

    To implement some sort of notification on the homescreen, I superimpose a 15 x 15 icon in the upper left corner of the home screen of 32 x 32 icon and use HomeScreen.updateIcon (Bitmap).

    After calling updateIcon(), the icon appears cropped on the edge of the pie chart 30 x 30.

    Front

    After

    This cropping only occurs when the notification icon is drawn on a portion of the icon to the home screen which has under transparent pixels (seems the operating system creates a mask by reversing the transparent pixels or something?).

    Any ideas?

    (Edit: tested on 4.3, 4.5, 4.6 simulators)

    This problem has been reported to our development team.

  • My apps don't download or update on the App Store, what to do?

    Hey!

    My App Store is not automatically updated all the apps for a few weeks, even though I have the "update automatically" setting on. (And no, these updates don't require Wi - Fi update, my 4G mobile data should have been fine.) Now, it has got to the point where I can't update all apps even manually. I click the icon "update" and the circle of progress appears but doesn't begin to increase. It is just stuck. How can I fix?

    I am also unable to download/install new applications. This happens with all applications I've tried to install isn't about specific app. I have rebooted my phone, checked my settings App Store and internet, disconnected and connected on my Apple ID. I also reset my network settings. I tried to download with a Wi - Fi connection and mobile data with applications that don't require Wi - Fi connection to intall. All several times and during the time period of a few days. I have no restrictions on.

    When I click on the "install" button, it shows just the circle of progress without the mean square and it remains stuck with no progress. Sometimes the application displays a white icon on my home screen, but not every time. If so, I can not remove it directly but I can stop the 'installation' in the App Store that makes the white icon will eventually disappear. I have an application that has survived exceeded installation stage of the white icon, but got stuck on "pending". I can click on it, but nothing happens.

    I have the software of the iPhone 6 and 9.3.1.

    I am really desperate for a response, please.

    Try going into settings > general > Restrictions > and make sure that iTunes Store, Apps install, delete the Apps and In - App purchases are all under the section allow. Try to install again.

    If the above does not work:

    Close the App Store completely from the window of the selector app by double clicking the Home button and slide up the App Store preview pane until it disappears from the display. You may be able to pick up the tab App Store covering scribbles to the left.

    Then sign out of the iTunes Store (in the settings).

    Then perform a forced reboot. Hold down the Home and Sleep/Wake buttons simultaneously for about 15-20 seconds, until the Apple logo appears.

    Then reconnect to the iTunes Store.

    If neither works you may have a corrupt system and would have to do a restore. I restore as a new and test the phone as the backup may be corrupted. Make sure to import all your photos and important data first. If the backup is corrupted, restore it will bring back the corruption.

    https://support.Apple.com/en-us/HT201252

  • Qosmio X 70-B-10 t and win 10 update

    The system is updated with no missing Windows updates.
    Still missing the 'Get Windows 10' icon on the taskbar.

    Tried all the scripts to manually at the outbreak of the GWX but nothing helped.
    Looking at the matter in the event viewer, he meets error below & don't could start.

    Informational message: main GWX: launched for the start of the status bar

    Informational message: GWX CompatLib: read correctly markers
    Informational message: download pre - req config/content failed
    Informational message: Machine is not managed in MDM
    Informational message: Windows is activated
    Informational message: pre - req config / policy has failed. Change of phase at None
    Informational message: GWX App: calculated phase current 'None' is not configured to run the tray approx. Exiting.

    Any help / suggestions would be greatly appreciated...

    Thanks in advance...

    According to the official statement from Toshiba, this laptop should get the update to windows 10 yesterday. Anyone with the same laptop already has managed to get the icon / update?

    Hi, marto,

    I have a different (X 70A) model that was supposed to support Windows 10 January 2016. I decided to go for it myself using the manual setup - I just went to https://www.microsoft.com/en-us/soft...load/windows10, downloaded media creation tool has run the tool and chose "upgrade".

    Be warned, however, that things could go wrong, so will any of this, unless you are ready for it (in my case I had all network interfaces fails).

    Good luck if you decide to upgrade!

  • Video on Skype updates

    Hello

    Which suggests a video-webcam next to a person icon updated on Skype? This person is currently displayed in offline mode, but the webcam icon is on next to his name, (after his status message) when I look at my updates.

    If I look at my contacts, I don't see this icon webcam shows, only when I scroll through updates, can you tell me if this means that the person has blocked me and is currently on a video call to someone?

    This means exactly nothing; just a standard form to view all your contacts mood message updates.

  • keep Windows update install 'kb2518864' / 'kb2572073' / 'kb2633880' repeatedly

    Original title: windows update keep installation kb2518864/kb2572073/kb2633880 since this morning

    The event viewer displays messages that says that each is installed successfully, but they do not appear in the list of "Add or update the program" in the control panel and immediately after it tries to install the 3 again and again. (each of them seeks to update .net framework 2.0sp2 or 3.5sp1)

    BTW, I'm under XP Pro SP3 with all latest updates.

    It seems that MS has solved the problem, all of a sudden the yellow reminder icon disappeared at the bottom of the screen. A number of people has the same reporded at the end of this thread.

    1450 EDT

    It seems to have been corrected here too well, even without emptying the memory cache update.  Just all of a sudden the icon "updated pending" went.

  • Updates to Windows KB2844285 and KB2833940 keep appearing

    The above updates keep appearing and update windows history say, they have been installed successfully many times.

    Is this a Microsoft Update site problem or a problem with my pc? Windows xp.

    Tried a few repair Microsoft update tool and it didn't work.

    The yellow shield icon update is constantly in the status bar.

    Hi Andrew. It is a common problem with updates of .NET. Here are the steps I follow

    First try this...

    Download and run the Microsoft .NET Framework repair tool , then visit Windows Update and let it try to reinstall updates. Once it's done, scan again with Windows Update to ensure that they properly installed.

    If this does not fix it try this...
    Try to install the updates manually. Follow the links to the downloads.
    KB2833940 - NDP20SP2-KB2833940 - x 86-.exe
    KB2844285 - NDP20SP2-KB2844285-v2 - x 86-.exe
    Once you have installed, visit Windows Update, let it scan and see if they are still revived.

    If this is not yet it solves, we need to check if you don't have .NET 2.0 or have .NET 2.0 under .NET 3.5. .NET 3.5 installs 2.0, 3.0, and 3.5.

    You can check for their presence in Add or remove programs or download .NET detector, a very small, stand-alone program that displays the versions installed in bold.

    If you don't have .NET 2.0 can do this...

    Uninstall the .NET Framework 2.0.
    Reinstall .NET Framework 2.0
    Visit Windows Update and let it install the rest of the 2.0 updates, including KB2833940 and KB2844285.

    See if that makes the problem disappears.

    If you have .NET 2.0 as part of a .NET 3.5 installation do that...

    Open Add or remove programs, click on .NET 3.5 and choose repair. I didn't get around to check this fix actually .NET 2.0 also, but it's worth it. I do not know if it can also cancel updates already installed .NET. If so, they will reinstall when you perform a Windows update that is the next step after the repair.

    If the repair does not fix it, will add and remove programs and uninstall the .NET Framework 3.5, 2.0, then 3.0.
    Visit Windows Update, choose this first installation and custom scan...

    High priority.
    .

    If it is not under a high priority, see software, optional.

    It must be installed by itself. Windows Update will not let you do otherwise.

    When he did install (I forgot if she asks for a restart or what not), scan again and all updates for .NET 2.0, 3.0 and 3.5 of the .NET .NET must appear. Choose to install.
    A new analysis to ensure that they properly installed.

    If all goes well, that will solve the problems you face.

    Make sure you come back and let us know which method worked for you or if you still have problems, I have to run a cleaning tool.

    Good luck!

  • Recycle Bin Icon does not refresh from full to empty or vice versa

    Hello world

    My Recycle Bin icon updates not from full to empty or vice versa.

    First of all, I deleted the icon then went into Control Panel, folder customization, change Desktop Icons and selected from the trash, then press on apply. but without success.
    If I click on the desktop, right-click and select Refresh, it works.
    Concerning
    Cimjet
    Hello world

    My Recycle Bin icon updates not from full to empty or vice versa.

    First of all, I deleted the icon then went into Control Panel, folder customization, change Desktop Icons and selected from the trash, then press on apply. but without success.
    If I click on the desktop, right-click and select Refresh, it works.
    Concerning
    Cimjet

    Recycle Bin not refreshing
    http://www.Vistax64.com/tutorials/66294-Recycle-Bin.html

Maybe you are looking for