New JList loses the listener.
I have a gui, which I need to update with new lists depending on the selection of the user. The list is being listened to by ListSelectionListener. After I new the JList (for updating with new values). The listener doesn't recognize the source anymore. Any clues as to why?
Code snippet below. getAttrs() function is called
based on some selection by the user. So if the selection changes, this fn will be called.
getAttrs() {
Vector listVec = new Vector();
listVec.add(...
listVec.add(...
attrList = new JList(listVec);
attrList.addListSelectionListener(new ListSelectionListener(){
public void valueChanged(ListSelectionEvent ev) {
Object src = ev.getSource();
System.out.println("src:"+src.toString());
if ( src == attrList ) {
if (!ev.getValueIsAdjusting()) {
Object[] selectedObjs = ((JList)src).getSelectedValues();
if (selectedObjs.length > 1) {
System.out.println("multi objects");
else {
String attrName = (String)selectedObjs[0];
System.out.println("attr"+attrName);
setDetailValues(attrName);
else {
System.out.println("value is still changing");
else {
System.out.println("not attrList");
What happens is that first time, it works oks and recognozes the src. next time (when the user selection changes and this function is called again) it says "not attrList" meaning it doesnt' reconize the src.
Where do you add the JList? It looks like you added the first JList to a Container. The next time through this method, you are changing only the attrList reference, not the original and different JList object that you added. I think the original listener is what's being called, and since the old JList is calling the listener, the source is not the same as the attrList JList.
Instead of making a new JList, you should update the original JList that you added.
Similar Messages
-
I recently changed my apple ID but the old on is still on my iCloud account. The old address is dimmed on iCloud on my iPad so I can't change it. How do I change to the new address? I don't want to delete the account as I don't want to lose the pictures
To change it, you have delete the existing account. However you can avoid losing any pictures in the process. To avoid losing photo stream photos, save them to your camera roll (if not already there) before deleting the account. To do this, open your my photo stream album, tap Edit, tap the photos, tap Share, then tap Save to Camera Roll. (Camera roll photos are not effected by deleting the account.)
Then go to Settings>iCloud, tap Delete Account, then sign back in with the new ID. This deletes the account and your iCloud data from your device, but not from iCloud. Provided you are signing back into the same account, your iCloud data will reappear on your device when you sign back in. -
Question: How do I copy (old) music content from iPod to iTunes on a new PC? I don't want to lose the content on my iPod.
How to use your iPod to move your music to a new computer
-
for some reason , when i restore my iphone 4s to factory settings my headphones work when listening to music or youtube videos but when i backup my information onto it , it only comes out of one ear bud and i just got a new one from the apple store. my old iphone 4s audio jack was messed up but i just got a new one with my warranty , can anyone help me please.
It doesn't matter what it is in your backup that's causing the problem because you can not selectively restore things from your backup. It's all or nothing.
Set you phone up as a new device and start over. -
My old PC broke, it was the only pc my classic was sync with. New PC only shows 1 song (recent purchase) so am worried about syncing to new PC in case I lose the list on my iPod, which is still intacted. How can I transfer my list to new PC?
I'm having a similar problem, but I do have the key and is not working anyway.
My old pc was running on windows 7 and my new one is an apple running on Lion.
My phone is an Iphone IV and I can see all the bookmarks there.
In order to sync, what I did was click on the "I don't have the device with me", I entered the key that was provided and the process finish ok. It says congratulations, etc, etc.
But the bookmarks are not there, I tried merging data and replacing data on this computer options but is the same.
Any suggestions? -
I want to sync my iPod Touch to my new computer. I've added a lot of music to my computer iTunes and don't know if I will lose the music on my computer or my iPod when I sync. What do I do to keep all from both devices?
You can only sync with one computer To switch computers and not lose anything:
Syncing to a "New" Computer or replacing a "crashed" Hard Drive: Apple Support Communities -
I had an unauthorized purchase on my old apple ID so I created a new one since the old one had been deactivated and now I cannot update any of my apps, I have read that the apps will be tied to the old account but since the old one was deactivated I cant update them and I do not want to delete/lose their data, re download, and start all over again. Is there anyway to go around this issue?
thanksAsk Apple to re-enable it. I had an unauthorized purchase last October. They disabled my account until the problem was solved. However, I asked them to reopen it, and they just asked me to provide some security information (billing address, a recent purchase you made, etc.), and then they re-enabled it.
-
Hi there,
Wondering if you might know? I don't have enough space to update the new software on iPad. So my facetime isn't working anymore, this is prob why. Seems I have to delete like all the games/apps we have to do so. Will I lose the progress data/levels in the games? But how do I back up the games data?
Please help. Scared to delete them to update and then not have the space to restore them and if I get them again will the levels/progress be gone?
Thanks RachelConnect your device to iTunes and do the update through iTunes. Using a computer takes much less space on your device than doing the update on your device.
-
I want to deauthorize an iPad and authorize it with a new Apple ID but I dont want to lose the apps that were purchased under the first Apple ID. Will this happen?
Welcome to the Apple Support Communities
You won't lose the programmes, but you won't be able to update them as it will ask you for your old Apple ID to update -
I used to be able to open BBc Radio 2 via the 'Listen' link with a left click of the mouse button, this nolonger works, I now have to right click the link and 'open link in a new tab'
I must have disabled something?
If you can help then please make it easy for me to understand.
Thanks
Regards
Rj2 Solutions found in [http://support.mozilla.com/en-US/questions/791244]
the user cor-el has a method that does not require any add-ons. He States
This code in userChrome.css will move "Open Link in New Window" to the top of the context menu.
<pre>@namespace url("<a href="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul</a>"); /* only needed once */
#contentAreaContextMenu > * { -moz-box-ordinal-group: 2; }
#context-openlink { -moz-box-ordinal-group: 1 !important; }</pre>
the user jay_ff shows how to do it using the Menu Editor Add-on
1. Install the Menu Editor add-on from https://addons.mozilla.org/en-US/firefox/addon/menu-editor/ .
2. After the installation, go to Firefox> add-ons (or simply use Ctrl+Shift+A)
3. Go to the Menu Editor "Options"
4. In the "Main context menu," simply grab the "Open link in New Tab" and place it below the "Open Link in New Window"
5. and Voila! You may also change other menu options if you want to!
I tried jay_ff method first and found that indeed changing the Main Context Menu did cause the hotlink context menu to change as well. -
yeah please answer the question..i downloaded songs on my other computer and they are on my ipod but do not show up on my itunes because they are not downloaded..will i lose the songs if i sync my ipod?
Yes.
You need to copy everything from your old computer, or your backup copy of your old computer, to your new one.
You can transfer itunes purchases from your ipod: File>transfer Purchases -
i have a new computer and want to sync my phone to the new but dont want to lose the information. how do i transfer. i was told there was a way but not sure how
for the purchased items from the iTunes Store, you could use transfer of purchases
for the photos, other music/movie not from itunes, you'll be needing a third party application
for contacts, calendars , photos from camera roll : you could just directly transfer it from your phone to the computer. -
I would like to set up an older iPad with a new messages account so it can be used by my kids. I don't, however, want to lose the apps or music that are on the iPad. Can I change only the Messages "account"?
Thanks. I had tried that, but was still having problems. Then I realized that I was using three addresses on both devices. Once I changed it to only one email on one iPad and a different email on the other, it worked great. Your message encouraged me to dig deeper and think differently. It worked. Thanks again!
-
I have an existing ipod that I use with my mac. I am trying to connect an additional ipod to it but when I try and register, it just brings up the existing info. I don't want to lose the original info or library - just create new for this device. Pls help...
We are starting from the beginning like its a new ipod starts out asking language, country,location services,choose a network,and when we get to "setup ipod touch " there are 3 options 1..setup as new ipod, 2.restore from ipod backup 3 restore from itunes backup and when we hit setup as new ipod and click next it comes up with sign in with apple id or create a free apple id we clicked create a free apple id....then comes up with bday,1st name last name, use your current email address, get a free icloud email address or change email address and THIS is where we have problems....if we hit change email address it means that sis's stuff goes under his name and moves all her stuff to this older ipod which the brother does not want. sorry this is so long but its the only way I knew to do it.
-
I have a new computer. I've installed iTunes. I don't want to lose the calendar and contact data nor the apps currently on my iPod Touch. Will that happen when I sync?
I don't think so. When you open iTunes, go to "Store" on the top and click "Authorize this Computer." Type in your email and pass, and click authorize. Then, when you connect you iPod for the first time, it should tell you "this iPod is synced with another computer, blah blah." It should give you the option to either "Erase and Sync," or "Transfer Purchases." Click "Transfer Purchases and your content should go into your new iTunes.
If this doesn't work and you still have your old computer there's another thing you can do. I know this works on windows, but I'm not sure how to do it on a Mac, maybe someone can offer some help. Assuming you have Windows, go to Start>Music>iTunes Media and you should see Music, Apps, Movies, etc. This is all the stuff in your iTunes. If you have an external hard drive or your iTunes library is small in terms of file size, you can do this in one go. Transfer the content (as much as you can fit at one time) onto the external storage. Then, put that content on your new computer on the desktop or somewhere where you can find it again. Open iTunes, and folder by folder highlight everything in the folder and drag it into the iTunes library. It should say "importing (content)" or something and then it should be in your library. If you look in your Music folder again, there should now be another "iTunes" folder there with all of your content back in it.
Hope one if these options works for you. Best of luck!
Maybe you are looking for
-
How do I use airport utillity with Time Capsule(or any airport extreme) over the internet without mobile me? iCloud has disabled this function. The mac's that I have not upgraded to icloud still see my routers over the internet with mobile me enabled
-
Database Connection error in Crystal Reports using SAP BW system
Hi, While using Crystal Reports in trying to build a report on the SAP Query in SAP/BW System using the MDX driver, I am able to get the structure of the query fields into the report but on the other hand while trying to refresh the report for data I
-
Why is unread messages not updated in mail.app until restart
I have imap accounts in mail.app and on my iPhone and my iPod Touch and they are are all setup the same. If I read a msg on the mail.app, it is marked as read correctly and this also shows up on the iPhone and the iPod. But if I read the msg any othe
-
Hello, I am trying to convert a normal for loop to the new foreach loop. I was able to do one function that prints every element, but can't seem to be able to modify the elements in the array. //This works ok public static void printjoy(int [][] arra
-
Printouts are faint in Mountain Lion
I recently upgraded from 10.6.8 to 10.8.3. Even with new drivers from the Canon website, my PIXMA MP490 printouts are faint. Printouts are perfect if I reboot from 10.6.8 backup drive. How to control print quality in 10.8.3? Am I missing a settin