ListCellRenderer causing extra looping and slow down, please help

Guys
Please could you kindly help me with my long-lasting problem
concerning ListCellRenderer.
I sent it originally to Programming Essentials but no replies at all:
http://forums.sun.com/thread.jspa?threadID=5388059&tstart=15
Here is more detailed description of my problem that did not fit to my original posting (chech link above):
For your convenience I made a special simplified version of my problem.
Here are two fully compilable java-files that indicate my problem with simple GUI and System.out.print output. Please try to run my program, please.
I try use ListCellRenderer and ListSelectionListener with a simple interactive list that contains four names, either male or female names, like:
Bill
James
Martin
Peter
With a simple button "Change gender" the names can be changes to female names, and then again male names, etc...
If you select THE FIRST NAME in the list and press "Change gender" button, the System.print.out shows unnecessarily repeating loops.These accumulating extra loops slow seriously down performance with long lists.
Example output (the first name selected, so accumulating extra loops!!):
Entering method ChangeGender
ChengeGender method (name, index): Bill, 0
Cell renderer (name, index): Bill, 0
ChengeGender method (name, index): James, 1
Cell renderer (name, index): Bill, 0
Cell renderer (name, index): James, 1
ChengeGender method (name, index): Martin, 2
Cell renderer (name, index): Bill, 0
Cell renderer (name, index): James, 1
Cell renderer (name, index): Martin, 2
ChengeGender method (name, index): Peter, 3
Cell renderer (name, index): Bill, 0
Cell renderer (name, index): James, 1
Cell renderer (name, index): Martin, 2
Cell renderer (name, index): Peter, 3
Quitting method ChangeGender
However, if you select OTHER NAMES THAN THE FIRST ONE (or no names at all) and press "Change gender", then no extra loops occur in System.out.print. Why?
Example output (the second name selected, so no extra loops):
Entering method ChangeGender
ChengeGender method (name, index): Bill, 0
ChengeGender method (name, index): James, 1
ChengeGender method (name, index): Martin, 2
ChengeGender method (name, index): Peter, 3
Cell renderer (name, index): Bill, 0
Cell renderer (name, index): James, 1
Cell renderer (name, index): Martin, 2
Cell renderer (name, index): Peter, 3
Quitting method ChangeGender
I will have list containing hundreds of names and therefore extra loops slow severely my application.
Please explain how to avoid extra loops, also when the first name is selected.
And please - if just possible - show me exactly which rows of my program must be rewritten and how.
Thank you very much!

Change
for (int counter = 0 ; counter < names.length; counter++) {
    defaultListModel.addElement(names[counter]);
}to
ListDataListener[] listeners = defaultListModel.getListDataListeners();
for(ListDataListener listener : listeners) {
    defaultListModel.removeListDataListener(listener);
for (int counter = 0; counter < names.length; counter++) {
    defaultListModel.addElement(names[counter]);
ListDataEvent evt = new ListDataEvent(defaultListModel,
        ListDataEvent.INTERVAL_ADDED,0,names.length-1);
for(ListDataListener listener : listeners) {
    defaultListModel.addListDataListener(listener);
    listener.intervalAdded(evt);
}

Similar Messages

  • Hello, I'm pretty sure my fan on my 2009 mac book pro has stopped running. Would this cause the computer to slow down and take for ever to boot up and show the color wheel every time I select an application ?

    Hello, I'm pretty sure my fan on my 2009 mac book pro has stopped running. Would this cause the computer to slow down and take for ever to boot up and show the color wheel every time I select an application ? how involved to replace fan ? cost ?
    thanks

    Not directly, but if the CPU overheats because of incompatible software, that would cause slowdowns. Do not allow the computer to run if the fan is not working unless you wish to fry your motherboard. Please make a Genius Appointment and take it in for service.

  • I am having issues related to storage and I believe this is causing my computer to slow down. "Other" files part is the major occupier(180 GB). I have done Omni disk and multiple other cleaning(iTunes-device, restart, etc), yet have not been able to empty

    I am having issues related to storage and I believe this is causing my computer to slow down. "Other" files part is the major occupier(180 GB). I have done Omni disk and multiple other cleaning(iTunes-device, restart, etc), yet have not been able to empty any more space, nor to speed up my computer? Any suggestions? All your contributions are welcomed. Thanks. Mehmet Mazhar Celikoyar

    Below is the result:
    Hardware Information:
              MacBook Pro (15-inch, Mid 2009)
              MacBook Pro - model: MacBookPro5,3
              1 3.06 GHz Intel Core 2 Duo CPU: 2 cores
              4 GB RAM
    Video Information:
              NVIDIA GeForce 9400M - VRAM: 256 MB
              NVIDIA GeForce 9600M GT - VRAM: 512 MB
    Audio Plug-ins:
              BluetoothAudioPlugIn: Version: 1.0
              AirPlay: Version: 1.9
              AppleAVBAudio: Version: 2.0.0
              iSightAudio: Version: 7.7.3
    Startup Items:
              HP IO - Path: /Library/StartupItems/HP IO
    System Software:
              OS X 10.9 (13A603) - Uptime: 3 days 22:8:6
    Disk Information:
              ST9500420ASG disk0 : (500.11 GB)
                        EFI (disk0s1) <not mounted>: 209.7 MB
                        Macintosh HD (disk0s2) /: 499.25 GB (220.49 GB free)
                        Recovery HD (disk0s3) <not mounted>: 650 MB
              HL-DT-ST DVDRW  GS23N 
    USB Information:
              Apple Inc. Built-in iSight
              Apple Internal Memory Card Reader
              Apple Inc. Apple Internal Keyboard / Trackpad
              Apple Computer, Inc. IR Receiver
              Apple Inc. BRCM2046 Hub
                        Apple Inc. Bluetooth USB Host Controller
    FireWire Information:
    Thunderbolt Information:
    Kernel Extensions:
              com.rim.driver.BlackBerryUSBDriverInt          (0.0.64)
              com.livedrive.filesystems.livedrivefs          (2.1.14)
    Problem System Launch Daemons:
    Problem System Launch Agents:
    Launch Daemons:
              [loaded] com.adobe.fpsaud.plist
              [loaded] com.adobe.versioncueCS4.plist
              [loaded] com.creativebe.MainMenuHelper.plist
              [loaded] com.macpaw.CleanMyMac2.Agent.plist
              [loaded] com.magican.castle.plist
              [loaded] com.microsoft.office.licensing.helper.plist
              [loaded] com.rim.BBDaemon.plist
              [failed] com.zeobit.MacKeeper.plugin.AntiTheft.daemon.plist
    Launch Agents:
              [loaded] com.adobe.CS4ServiceManager.plist
              [loaded] com.hp.messagecenter.launcher.plist
              [loaded] com.hp.productresearch.plist
              [loaded] com.rim.BBLaunchAgent.plist
    User Launch Agents:
              [loaded] com.adobe.ARM.[...].plist
              [failed] com.macpaw.CleanMyMac2Helper.diskSpaceWatcher.plist
              [failed] com.macpaw.CleanMyMac2Helper.scheduledScan.plist
              [failed] com.macpaw.CleanMyMac2Helper.trashWatcher.plist
              [failed] com.UninstallerTool.plist
              [failed] com.VolumeWatcherTool.plist
              [failed] com.zeobit.MacKeeper.Helper.plist
    User Login Items:
              BlackBerry Device Manager
              HP Scheduler
    3rd Party Preference Panes:
              Adobe Version Cue CS4
              DC30 Xact Driver Panel
              Flash Player
              Flip4Mac WMV
              Perian
    Internet Plug-ins:
              AdobePDFViewer.plugin
              AdobePDFViewerNPAPI.plugin
              Default Browser.plugin
              Flash Player.plugin
              FlashPlayer-10.6.plugin
              Flip4Mac WMV Plugin.plugin
              iPhotoPhotocast.plugin
              JavaAppletPlugin.plugin
              OfficeLiveBrowserPlugin.plugin
              QuickTime Plugin.plugin
              SharePointBrowserPlugin.plugin
              Silverlight.plugin
    User Internet Plug-ins:
              OctoshapeWeb.plugin
    Bad Fonts:
              None
    Time Machine:
              Mobile backups: OFF
              Auto backup: NO
              Volumes being backed up:
                        Macintosh HD: Disk size: 499.25 GB Disk used: 278.75 GB
              Destinations:
                        TOSHIBA EXT [Local] (Last used)
                        Total size: 2 TB
                        Total number of backups: 5
                        Oldest backup: 2013-10-24 23:21:31 +0000
                        Last backup: 2013-10-25 02:59:08 +0000
                        Size of backup disk: Excellent
                                  Backup size 2 TB > (Disk size 499.25 GB X 3)
    Top Processes by CPU:
                   3%          WindowServer
                   1%          EtreCheck
                   1%          Microsoft PowerPoint
                   0%          BBLaunchAgent
                   0%          fontd
                   0%          aosnotifyd
    Top Processes by Memory:
              168 MB             Microsoft PowerPoint
              123 MB             Safari
              86 MB              Mail
              74 MB              WindowServer
              45 MB              com.apple.WebKit.Networking
              45 MB              com.apple.WebKit.WebContent
              41 MB              Finder
              41 MB              PluginProcess
              41 MB              mds_stores
              33 MB              Notes
    Virtual Memory Statistics:
              72 MB              Free RAM
              1.27 GB            Active RAM
              1.24 GB            Inactive RAM
              667 MB             Wired RAM
              2.58 GB            Page-ins
              111 MB             Page-outs

  • My browser takes minutes to open then when the tab is fully loaded it will start saying "Connecting" and slow down or freeze.

    When I open my browser, it takes 3-5 minutes to fully open. When I get to a website, randomly the tab will say 'Connecting' and slow down and take 10-15 minutes to function or freeze completely. This almost always happens on sites that require Flash Player use. I have uninstalled and reinstalled my Flash several times. I've added memory, as someone suggested it was a memory issue. It's so frustrating, please help!

    A possible cause is security software (firewall) that blocks or restricts Firefox or the plugin-container process without informing you, possibly after detecting changes (update) to the Firefox program.
    Remove all rules for Firefox from the permissions list in the firewall and let your firewall ask again for permission to get full unrestricted access to internet for Firefox and the plugin-container process.
    See:
    * [[Server not found]]
    * [[Firewalls]]

  • Messages are in to be delivered state and slows down the message processing

    Hello,
    Messages are in to be delivered state and slows down the message processing.
    this happenens in case of DB2 on some machine where the issue about high load on DB2  is caused by standard programming in SAP XI that executes a statement, where it uses the condition 'where 1<0' prio to the original  SQL statement configured in the channel configuration,
    Can you please help me out in solving this issue?
    Thanks,
    Soorya

    Status: TO_BE_DELIVERED
    Which means that the message was successfully delivered from Integration Server point of view and it states that the messages is initially handed over to the Messaging System.
    TO_BE_DELIVERED occurs while the message is put into the Messaging System receive queue.
    Solution:
    This is done via the Messaging System receive servlet:
    http://<Host>:<PORT>/MessagingSystem/receive/<CONNECTION>
    /<PROTOCOL>
    Only if this was executed successfully the Messaging System returns HTTP 200 to the Integration Server and the Status TO_BE_DELIVERED moves to DELIVERING
    1. Try logging into Sap GUI with two users: XIAPPLUSER & XIAFUSER
    to see if they are blocked
    2. We can check the messages:
    AdapterFramework
    com.sap.aii.adapterframework.serviceuser.language
    com.sap.aii.adapterframework.serviceuser.name = XIAFUSER
    com.sap.aii.adapterframework.serviceuser.pwd
    ApplicationSystem
    com.sap.aii.applicationsystem.serviceuser.language
    com.sap.aii.applicationsystem.serviceuser.name = XIAPPLUSER
    com.sap.aii.applicationsystem.serviceuser.pwd
    in the exchange profile to make sure the right passwords

  • After upgrading from Snow Leopard to Mountain Lion, the text preference, Middle Eastern, causes Photoshop CS6 to slow down.  Can this be fixed?

    After upgrading from Snow Leopard to Mountain Lion, and setting the text preference, Middle Eastern, causes Photoshop CS6 to slow down.  Can this be fixed?

    I'm Win, not Mac, but I do have a couple saved messages
    Mac 10.8.3 Bug w/Encore and BluRay http://forums.adobe.com/thread/1198709
    -create folder not ISO http://forums.adobe.com/thread/1216127

  • Speed up and slow down tracks

    I need a program that I can speed up and slow down tracks with. Is that possible in Logic Express? I know that it can be done in Logic Pro, however I don't need quite that much program.

    xcuse me if i jump in here without answering the original question, but that brings up something similar to me:
    if i have a setup in the arrange with a combination of various audio-files, apple loops and midi-tracks, and i want to record something additional into that (midi over connected edirol midi-keyboard): can i slow down the whole song, just to make it easier to record the new part without destructively destroying anything?
    and after that just go back to the original song-tempo?
    thanx a bunch for any thoughts!
    again, sorry balletboy for jumpin in here, hope that is ok for you :o)

  • Can the wireless card in my mac wear out and slow down internet connection??

    can the wireless card in my mac wear out and slow down internet connection??

    Yes the WiFi card can wear out but not what you would really call wearing out like a pair of pants do. It can start to fail causing the connection between your computer and your Wifi router to slow down, IE transmit and receive less data in a given time period. And then it will fail completely.
    But as to your internet connection being affected by a failing WiFi card no that can't happen.
    If you turn the WiFi off and connect the computer to your router with an Ethernet cable does your internet browsing and downloading speed increase? If it does then there may be something wrong with the WiFi card in your computer or the WiFi section of your router. Hard to say which.
    If after connecting the computer to your router with an Ethernet cable and your speeds do not increase then it is a problem with the router or on your ISPs end.

  • GE60 fan problem. speeds up and slows down constantly [EC reset done]

    My model is GE60 OCN and bios and EC is the newest ones for win7 embeded on msi website.
    I have the same problem with others if you search here 'ge60 fan'.
    The temperature between 50~60℃ the fans runs slow and really quite.
    But if the temperature goes down under about 46℃, it speed up and slows down constantly and it is annoying and much noiser.
    I think msi should provide new EC firmware for this. Even the temperature is low, it annoys and nosier than when the temperature is between 50~60℃.
    Please check this problem and provide new EC firmware for fan policy.
    Someone has uploaded video link: youtube.com/watch?v=OQjjjVOpsEQ
    this is exact problem with me as well.

    I have exactly the same problem. Let's continue in the other thread (https://forum-en.msi.com/index.php?topic=165613.0)

  • I keep getting message "mozila Firefox not responding." It takes minutes to down load a site - some times it just gets in a loop and never down loads. Then when I try to click on it again screen goes opaque and i get the same message.

    I 'm getting message "Mozila Firefox not responding." It takes minutes to down load a site - some times just gets in a loop and never down loads. The little circle at top just keeps going round in circles .
    Then when I try to click on the screen again the screen goes opaque and I get the same message re " Mozilla Firefox not responding" - and it is minutes before I can get back in to close down screen.
    I have downloaded Fire fox version 4 and this is still happening.

    See:
    * http://kb.mozillazine.org/Error_loading_websites

  • My iPod touch is permanently disabled and it says to connect my iPod to my iTunes yet when I do that, it tells me to type in pass code even though it's still disabled. i cant go to DFU mode cause my home button is broken PLEASE HELP ME GOD I MISS MY IPOD

    My iPod touch is permanently disabled and it says to connect my iPod to my iTunes yet when I do that, it tells me to type in pass code even though it's still disabled. i cant go to DFU mode cause my home button is broken PLEASE HELP ME GOD I MISS MY IPOD TOUCH PLEASE :'((

    i cant do that sir ,my ipod touch 4g keeps rebooting and rebooting all over again until the battery is empty HELP GUYS PLEASE

  • On iMovie for iPad2, is it possible to speed up and slow down voices?

    On iMovie for iPad2, is it possible to speed up and slow down voices? (in order to sound like a chipmunk for example) I know that it can be done on a Mac, but what about iPad?

    It it possible to speed up or slow down music from my iTunes file?
    http://www.bulletsandbones.com/GB/GBFAQ.html#changeimportedtempo
    (Let the page FULLY load. The link to your answer is at the top of your screen)
    cut
    http://www.bulletsandbones.com/GB/GBFAQ.html#cutsection
    (Let the page FULLY load. The link to your answer is at the top of your screen)
    http://www.bulletsandbones.com/GB/GBFAQ.html#cutsectionnospace
    (Let the page FULLY load. The link to your answer is at the top of your screen)
    blend
    open GB's help and search for "curve"
    I am using music from my iTunes.
    http://www.bulletsandbones.com/GB/GBFAQ.html#importfromitunes
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • What are the best editing softwares to create sequence shots and slow down video?, What are the best editing softwares to create sequence shots and slow down video?

    What are the best editing softwares to create sequence shots and slow down video?, What are the best editing softwares to create sequence shots and slow down video?

    Do you want free or do you want the best, your original post said best, now you are saying free. This is a contraction, there is no such thing as best free. There is such a thing as free and such a thing as best.
    Also is your focus video or photos?????

  • Wheel of doom spinning before I can log into the  pro. Never happened before. The wheel spun a lot when i was using it yesterday and slowed down usage

    wheel of doom spinning before I can log into the pro. So signing in was a panic attack in itself.
    Never happened before.
    The wheel has started to show up spun a lot when i was using it yesterday and slowed down general usage.
    what is happening to the mac and what can I do to bring it back to life (before the rainbow wheel of doom)

    If this has started happening suddenly without your having made any changes to your configuration, the it's likely that the boot drive is failing, or that there's some other hardware fault. Back up all data immediately, then run the Apple Hardware Test.
    Intel-based Macs: Using Apple Hardware Test
    Even if the test is negative, you should make a "Genius" appointment at an Apple Store to have the machine tested more thoroughly.

  • Making video start fast and slow down?

    I am trying to avoid doing this in FCP because I know speed changed video can be jumpy...
    Basically I have video that pans and I want to start fast, lets say 600% speed and slow down just at the end to 100%.
    I know that in motion it doesn't work with percentages, so how's the best way to go about this. I tried variable speed, but It starts slow then speeds up...
    Also, I would like to add a motion blur, is this achieved with activating motion blur in the render tab?
    Thanks

    Well, I had a bunch of videos that I overlaid with mattes to make it look like one continuous video... But the resulting video was 30 seconds and I needed it to be 5 seconds..
    So I exported a QT movie and re-imported it into Motion. Then I just went to the Timing property and changed the speed to variable. This gave me a key frame at the beginning and end of the clip. So I just dragged the keyframe at the end to 150th frame (for 5 seconds).
    But since I wanted to slow down the video just a tad at various points, I added a key frame to each area I wanted to slow. I then went into the Keyframe editor and made the interpolation to bezier, then just rotated the bezier to be horizontal. This slowed the video just a tad in each part.
    I also changed the frame blending to motion blur blending.
    Pretty straight forward once I got the hang of it.

Maybe you are looking for