JList bug? Or is it just me? Testers needed

I have been having a minor but definitely irritating problem with an application I wrote. In several places I have 2 JList boxes inside JScrollPanes. Clicking on an item in the first list should instantly update the contents of the second. Most of the time it does just that. But it seems like 20% of the time my mouse click is ignored, or atleast the action is not acted on (the first list's item gets highlighted, but the second list does not update). It seems to either be OS or JDK version related as I created a simple test program and tried running it on a different OS with a different version (Solaris server with JDK 1.2.2), and there it worked fine. My system, which is where the problem occured uses Win2000 and I am using JDK 1.4.0. I tried reporting this bug to Sun but they wrote back and said they could not reproduce the bug.
Is there some weird glitch with just my PC? Or has anyone else ever seen anything like this? I will paste my test program code below. To use it, just keep selecting different items in the left-hand list and noting whether the contents of the right-hand list change to match. If you can do this about 20 times and they stay in sync, then it works fine for you. Otherwise please let me know! And if anyone can actualy help me prove to sun that this is a bug, or provide a fully-functional workaround I'll hand out some Duke Dollars.
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.awt.*;
* Used to test an aparent bug in JList or MouseAdapter
public class JListTest extends JFrame
   private Container    contentPane;
   private JScrollPane  scrollOne, scrollTwo;
   private JList        listOne, listTwo;
   private static final String[] listOneItems =
      {"Letters", "Pets", "Names", "Sports"};
   private static final String[] letterItems =
      {"A", "B", "C", "D", "E", "F", "G", "H"};
   private static final String[] petItems =
      {"Cat", "Dog", "Bird", "Fish", "Lizard", "Feret"};
   private static final String[] nameItems =
      {"Joe", "Bob", "Mike", "Sally", "Julie", "Mary", "Tony"};
   private static final String[] sportItems =
      {"Football", "Basketball", "Hockey", "Baseball", "Track & Field"};
   * Constructor
   public JListTest()
      super("JList Test");
      contentPane = this.getContentPane();
      contentPane.setLayout(new BorderLayout());
      listOne = new JList();
      listTwo = new JList();
      listOne.setFixedCellWidth(200);
      listTwo.setFixedCellWidth(200);
      scrollOne = new JScrollPane(listOne,
               JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
               JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      scrollTwo = new JScrollPane(listTwo,
               JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
               JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      listOne.setListData(listOneItems);
      contentPane.add(scrollOne, BorderLayout.WEST);
      contentPane.add(scrollTwo, BorderLayout.EAST);
      this.setResizable(true);
      addEventHandlers();
      this.setLocation(100,40);
      this.pack();
      this.setVisible(true);
   private void addEventHandlers()
      listOne.addMouseListener(new MouseAdapter()
         public void mouseClicked(MouseEvent e)
            handleMouseClicks(e);
      // Handles clicking on the window's "x" button to close it
      this.addWindowListener(new WindowAdapter()
         public void windowClosing(WindowEvent e)
            System.exit(1);
   protected void handleMouseClicks(MouseEvent e)
      int listIndex = listOne.getSelectedIndex();
      if (listIndex == 0)
         listTwo.setListData(letterItems);
      else if (listIndex == 1)
         listTwo.setListData(petItems);
      else if (listIndex == 2)
         listTwo.setListData(nameItems);
      else if (listIndex == 3)
         listTwo.setListData(sportItems);
   public static void main(String[] args)
      JListTest jListTest = new JListTest();
}

I am not able to reproduce what you have seen, but have you tried using a ListSelectionListener in place of your MouseListener?
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.awt.*;
/*** Used to test an aparent bug in JList or MouseAdapter*/
public class JListTest
    extends JFrame
    private              Container   contentPane;
    private              JScrollPane scrollOne, scrollTwo;
    private              JList       listOne, listTwo;
    private static final String[]    listOneItems = {"Letters", "Pets", "Names", "Sports"};
    private static final String[]    letterItems  = {"A", "B", "C", "D", "E", "F", "G", "H"};
    private static final String[]    petItems     = {"Cat", "Dog", "Bird", "Fish", "Lizard", "Feret"};
    private static final String[]    nameItems    = {"Joe", "Bob", "Mike", "Sally", "Julie", "Mary", "Tony"};
    private static final String[]    sportItems   = {"Football", "Basketball", "Hockey", "Baseball", "Track & Field"};
    /**   * Constructor   */
    public JListTest()
        super("JList Test");
        contentPane = this.getContentPane();
        contentPane.setLayout(new BorderLayout());
        listOne = new JList();
        listOne.setFixedCellWidth(200);
        listOne.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // <------------------------------<<<
        listTwo = new JList();
        listTwo.setFixedCellWidth(200);
        scrollOne = new JScrollPane( listOne,
                                     JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                     JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
        scrollTwo = new JScrollPane( listTwo,
                                     JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                     JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
        listOne.setListData(listOneItems);
        contentPane.add(scrollOne, BorderLayout.WEST);
        contentPane.add(scrollTwo, BorderLayout.EAST);
        this.setResizable(true);
        addEventHandlers();
        this.setLocation(100,40);
        this.pack();
        this.setVisible(true);
    private void addEventHandlers()
        listOne.addListSelectionListener( // <------------------------------<<<
            new ListSelectionListener() {
                public void valueChanged(ListSelectionEvent e)
                    if ( ! e.getValueIsAdjusting()) { // <------------------------------<<<
                        handleListSelection();
        // Handles clicking on the window's "x" button to close it
        this.addWindowListener(
            new WindowAdapter() {
                public void windowClosing(WindowEvent e)
                    System.exit(1);
    protected void handleListSelection() // <------------------------------<<<
        int listIndex = listOne.getSelectedIndex();
        if (listIndex == 0) {
            listTwo.setListData(letterItems);
        } else if (listIndex == 1) {
            listTwo.setListData(petItems);
        } else if (listIndex == 2) {
            listTwo.setListData(nameItems);
        } else if (listIndex == 3) {
            listTwo.setListData(sportItems);
    public static void main(String[] args)
        JListTest jListTest = new JListTest();
}

Similar Messages

  • I have tried to install new update on iphone 5 and now it wont turn on when i plug it in the charger it just shows i need to connect to itunes.

    i have tried to install new update on iphone 5 and now it wont turn on when i plug it in the charger it just shows i need to connect to itunes.

    Given the state your device is in you have already erased your old stuff. You have an image on the screen that says, "Connect to iTunes." That's what the image means. So you will need iTunes on your computer.
    Upgrading iOS
       1. How to update your iPhone, iPad, or iPod Touch
       2. iPhone Support
       3. iPod Touch Support
       4. iPad Support
         a. Updating Your iOS from iOS 5 or Later
              Tap Settings > General > Software Update
         If an update is available there will be an active Update button. If you are current,
         then you will see a gray screen with a message saying your are up to date.
         b. Resolving update problems
            1. iOS - Unable to update or restore
            2. iOS- Resolving update and restore alert messages

  • HT5538 i can't find the facetime on my iphone i was using it before 1 month after that it's just disappear i need your help to get it back . thank you

    hello everyone i need your help please
    i can't find the facetime on my iphone i was using it before 1 month after that it's just disappear i need your help to get it back .
    thank you

    FACETIME MISSING
    The governments in some middle eastern countries have banned Facetime and it is disabled on iphones purchased in those countries.  The countries include KAS, UAE and others.  There is no way to get Facetime on such phones (for example it cannot be downloaded and installed) and taking the phone to another country does not cause Facetime to reappear on such phones. In  support.apple.com/kb/ts3367  it says “Note: FaceTime may not be available, or may become unavailable, on devices purchased or used in certain countries, including Saudi Arabia and the United Arab Emirates. Check your device's region of purchase for more information.”

  • I need help opening up the pdf doc that i just saved. i need to open it up with excel?

    I need help opening up the pdf doc that i just saved. i need to open it up with excel?

    Yes, I need help configuring the settings.
       Re: I need help opening up the pdf doc that i just saved. i need to
    open it up with excel?  created by David Kastendick<http://forums.adobe.com/people/dave_m_k>in
    Adobe ExportPDF - View the full discussion<http://forums.adobe.com/message/4711293#4711293

  • I cant find the download for 10.8 and every other software download just says "you need 10.8" to download.

    I cant find the download for 10.8. Every update I try to download and intall just says "you need version 10.8 to install but, I cant find 10.8 to download.

    When you do buy it from the Mac App Store  ($20), it will download to your Applications Folder as
    Install OS X Mountain Lion
    provided that your hardware can support Mountain Lion.  If your hardware is not capable, the Mac App Store will not let you buy it.

  • I can not active any app in creative cloud it's give me just trail and need serial number

    i use mac pro os x yosemite . and i have Subscription before tow monthes .
    i can not active any app and i try every thing in the site .
    help me please

    I try every steps in this link and it's till no work
    please help me.
    2015-03-16 18:47 GMT+03:00 Jeff A Wright <[email protected]>:
        i can not active any app in creative cloud it's give me just trail
    and need serial number
    Jeff A Wright
    <https://forums.adobe.com/people/JeffAWright?et=watches.email.outcome>
    marked Sheena Kaul
    <https://forums.adobe.com/people/Sheena+Kaul?et=watches.email.outcome>'s
    reply on i can not active any app in creative cloud it's give me just
    trail and need serial number
    <https://forums.adobe.com/thread/1744169?et=watches.email.outcome> as
    helpful. View the full reply
    <https://forums.adobe.com/message/7299205?et=watches.email.outcome#7299205>

  • My phone has just gone dead need to revive my phone, someone calling me can hear the dailer tone but i am not able to hear any ring, kindly suggest. the monitor is all blank

    my phone has just gone dead need to revive my phone, someone calling me can hear the dailer tone but i am not able to hear any ring, kindly suggest. the monitor is all blank

    Thank you so much you really hepled, my phone is working again phew!!!

  • I PAD 2 TESTERS NEEDED; IS THIS FOR REAL?

    IS ALL THIS I PAD 2 TESTERS NEEDED FOR REAL?

    Umm, little more information please?  Testing of what (an app, a case, a cover, a mobile solar charger - what are you being asked to test)?  By whom?  Who sent you the request to test something, or where did you see it?
    P.S. If it is Apple asking you to help them beta test some software, they do email people (using the email address registered with their AppleID) and the email will be pretty self explanatory.

  • My Ipod is 5-6 years old.  Suddenly, I'm getting audio through only one ear bud.  Is this a common occurrence?  And does this just mean I need to replace them?

    My Ipod touch is 5-6 years old.  Suddenly, I'm receiving audio through only one ear bud.   Is this a common occurrence?  And does this just mean I need to replace them? 

    It's fairly common for headphones after extensive use (5+ years).  If you have another set of headphones (any type with same connector), try it with the iPod to determine if the fault is on the headphones or on the iPod.  Or you can try the same headphones with another device, to see if they are working fine or you get the same audio problem.

  • Can someone else confirm this bug or is it just me?

    I think I've run into another *choose file name* bug. I have a script which uses the text returned from a *display dialog* command to gather part of the file name for a *choose file name* command. I usually paste the other part of the file name in off the clipboard. This all worked fine as long as I was running the script from within the Script Editor application. The problem I'm having started after I saved the script as an application. I cannot paste anything from the clipboard into the *choose file name* text field if it comes after another *choose file name* command or a *display dialog* command that has a text field.
    Harder to explain than to just show a couple of examples. Please check out these examples and let me know which text fields you are able to paste into...
    Example #1:
    <pre style="width:630px;height:auto;overflow-x:auto;overflow-y:hidden;"
    title="Copy this code and paste it into your Script Editor application.">set theText to "**Try To Paste Something Here**"
    choose file name with prompt "Works." default name theText
    choose file name with prompt "Doesn't Work!!" default name theText
    display dialog "Works Here Though!!" default answer theText</pre>
    Example #2:
    <pre style="width:630px;height:auto;overflow-x:auto;overflow-y:hidden;"
    title="Copy this code and paste it into your Script Editor application.">set theText to "**Try To Paste Something Here**"
    display dialog "Works." default answer theText
    choose file name with prompt "Doesn't Work!!" default name theText
    choose file name with prompt "Doesn't Work Here Either!!!" default name theText
    display dialog "Works Again Here Though!!" default answer theText</pre>
    As a workaround, I've started using another application, such as *System Events* or Finder, to display all *choose file name* commands. Like in this next example...
    Example #3
    <pre style="width:630px;height:auto;overflow-x:auto;overflow-y:hidden;"
    title="Copy this code and paste it into your Script Editor application.">set theText to "**Try To Paste Something Here**"
    display dialog "Works." default answer theText
    tell application "Finder"
    activate
    choose file name with prompt "Works." default name theText
    choose file name with prompt "Works." default name theText
    end tell</pre>
    Thanx in advance for taking the time to help me figure this out!!

    Say the clipboard content is JumpinJackFlash. The following script...
    <pre style="width:630px;height:auto;overflow-x:auto;overflow-y:hidden;"
    title="Copy this code and paste it into your Script Editor application.">set theName to text returned of (display dialog "" default answer "123456789")
    set theDest to choose file name default name (the clipboard) & "-" & theName</pre>
    ...works fine as long as I for sure want the name to be JumpinJackFlash-123456789. If I don't want to use the contents of the clipboard, and want to change the name to start with JackAndJill, I now have to delete the JumpinJackFlash part of the name in order to manually type in JackAndJill. This is just an arbitrary example, and I know this is a fairly trivial bug, but an annoyance that shouldn't be there. At least I've now confirmed that this doesn't just affect me and I've filed a bug report with Apple. We'll see where that gets us. I already have another bug report filed with Apple for *choose file name* regarding file extensions in the text field that they've informed me is a duplicate of someone else's earlier submission.
    Thanx so much for taking the time to check into this problem with me Pierre!

  • Music Playlist shows video playlists - iPod BUG. IS IT JUST ME?

    I have the 160GB ipod classic. I have several video playlists set up (to manage music videos, other movies, etc.). When I select "music" from the main menu, then select "playlists" to pull up my music playlists as set up on iTunes, I see all of my video playlists listed and they show "0 SONGS" under the playlist name, obviously because they are not supposed to have songs and only have videos. When I click on the video playlist from this menu, the ipod hangs on a white screen (forever!) until I press menu to return the music playlist menu... Is it just me or is this one of the many continued bugs that the iPod classic still has even after the 1.0.2 software update?
    APPLE - PLEASE FIX THIS BUG WITH THE OTHERS AND RELEASE 1.0.3 SOFTWARE ASAP!!!

    I did realize that I also have a "music videos" (smart) playlist that shows all music videos. Since these have songs in them, they are listed also...

  • JList bug help

    there's a bug in JAVA about JList that when you select an item the selectvalue sends it twice
    i got an answer but it doesn't work
    i build a Jlist from a list of items in a DB, first there put in an string[] then in a vector & then in the JList
    can anyone please help me

    Swing related questions should be posted in the Swing forum.
    there's a bug in JAVA about JList that when you select an item the selectvalue sends it twiceThis is not a bug.
    i got an answer but it doesn't workIts nice of you to share this answer. Are we supposed to quess what you have attempted to do.
    can anyone please help me Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/list.html]How to Use Lists for a working example on how to write your ListSelectionListener.

  • Adjustment layer bug - or is it just me?

    Somebody please try this and tell me if it's a bug or just me ...
    Create an adjustment layer over some video -- any video.
    Add 2 effects to the Adj Layer: Fast Blur and Levels.
    Set blurriness to 50. Set RGB White Input Level to 50.
    Now you should see Blur and Levels applied. All good so far.
    Now add some keyframes so the blurriness animates.
    How's it going?
    On my system, as soon as I try to animate 1 or more of the effects, they stop working entirely.
    This appears to be a bug. Or am I missing something?
    My workaround has been to use TWO separate Adj Layers on top of each other, but that is cumbersome and annoying.
    If anyone else experiences this, please file a bug report so we can get this resolved!
    Here's the link: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    You can just paste in the body of this post

    I tried the approach you've outlined.  I'm able to see the original effects on my clip as it plays, but the bluriness value doesn't animate.  I also tried using Gaussian Blur.  Same result.  I tried changing the order of effects.  Still didn't animate.
    I haven't used adjustment layers too much, yet.  I did use them on a project I finished last week, however.  I never ran into this on that project since, in my case, I wanted to keep my effects on separate adjustment layers anyway.
    But good to know there's another bug, or just the way it was built.  Maybe it's a feature request. 

  • Whitelist bug or a i just stupid

    o.k. i created a whitelist to add object embedding support...when i did, restarted the webservice and now the blog and wikis are disabled.anyone ever have this problem

    Doug,
    I have the same problem. I changed the owner & group permissions on the whitelist.plist file to _teamssserver. Here's the content - ultra simple - just trying to add an allowance for any style attribute in all tags:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.
    com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>tags</key>
    <dict>
    <key>all</key>
    <array>
    <string>style</string>
    </array>
    </dict>
    </dict>
    </plist>
    Here's the error (key part):
    File "/usr/share/wikid/lib/python/apple_wlt/ContentEntry.py", line 29, in <module>
    Nov 14 15:06:19 wiki com.apple.wikid[87990]: import ContentFilters
    Nov 14 15:06:19 wiki com.apple.wikid[87990]: File "/usr/share/wikid/lib/python/apple_wlt/ContentFilters.py", line 21, in <module>
    Nov 14 15:06:19 wiki com.apple.wikid[87990]: WhitelistContentFilter.WhitelistContentFilter(supportPath + 'whitelist.plist'),
    Nov 14 15:06:19 wiki com.apple.wikid[87990]: File "/usr/share/wikid/lib/python/apple_wlt/WhitelistContentFilter.py", line 125, in _init_
    Nov 14 15:06:19 wiki com.apple.wikid[87990]: for elm in userPlist['styles']:
    Nov 14 15:06:19 wiki com.apple.wikid[87990]: exceptions.KeyError: 'styles'
    Seems a lot of people are struggling with this issue. The documentation is a bit thin on the all feature. Do I have to have the other elements (protocol, styles) present also? I'm tempted to just change the python code, but would rather use the plist as intended.
    Thanks,
    RyanR>

  • JList bug, not always updates its UI

    I am using JList with a vector containing the data. (have call setListData() for the vector). when i add an element in the vector and call updateUI() method of JList, it updates its UI but not always. 20% of the time it fails to do so. Any Solution?

    Yeah, I have called repaint(), but the result is the same.
    repaint() does not work either. I have tried so many methods.
    like show() hide() repaint() invalidate() etc. etc. and much more but no one is working.
    Asim...

Maybe you are looking for

  • Cant print PDFs to network drive

    Im running windows 7 with acrobat pro x. When i print pdf to the local drive it works perfectly but when i try print to a network drive it does nothing. When i go to control panel and printter and double click on adobe pdf it shows that it tried but

  • Got my W520, now onto the setup questions...

    So, I just got received my W520 and I'm in the process of setting it up, but I've run to quite a few snags. I'd like to use my own imaging software (Terabyte Unlimited Image for Windows / Bootable Image for Linux). I created an image of the factory i

  • Ordinal - what we've got here is a failure to communicate

    I am running InDesign CS3 on XP.  I know there are other posts about ordinal problems, but none seem to lead me to a solution. My many fonts work with ordinal in MS Word when typing numbers like 22nd, 36th, etc.  However, the same fonts in InDesign d

  • What's the difference between masters, modified & original in iPhoto?

    Could someone please explain the difference between masters, modified and originals in the iPhoto Library? I am trying to make a backup online and want to cut out unnecessary transfer of data. I've recently installed an online backup service (with Li

  • My Locic 9 crashes after start-up when in 64 bit mode

    Anyone else? If I repair disk permissions & re-start, it will boot up. Other than that, it crashes. I'm using a Mac 2 x 3 Ghz Quad-Core Intel Xeon running 10.6.8. Logic version is 9.1.7. Anybody?