Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6441387

JList does not update when left in other workspace

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.6.0-beta2"
      Java(TM) SE Runtime Environment (build 1.6.0-beta2-b86)
      Java HotSpot(TM) Client VM (build 1.6.0-beta2-b86, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      Linux pandora 2.6.15-1-686-smp #2 SMP Mon Mar 6 15:34:50 UTC 2006 i686 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      JList view is not updated when a window, keeping the focus, is covering the Java application totally or only a part.

      However, that only happens if I reproduce the cenario above and change to other GNOME workspace, befor the JList is updated. I tested with another window manager (ION), and the result was the same.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      - Open a X terminal and run the test program.
      - Click on the "View" button.
      - Maximize the X terminal, hiding the Java application window.
      - Keep the focus on X terminal and switch to other GNOME workspace. (I tested on GNOME and ION window manager).
      - Wait for the thread updates the JList (10s on current implementation).


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The list of itens in JLIst should be refreshed, displaying only the new itens.
      ACTUAL -
      There is a mix of itens, i.e., the removed itens are still showed together with the new ones, but you can not select the removed itens.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      import java.util.Iterator;
      import java.util.Map;
      import java.util.HashMap;
      import java.util.UUID;
      import javax.swing.JFrame;

      /**
       *
       * @author Bruno Oliveira Silvestre
       */
      public class HostInfo extends JFrame {
          
          private class Timer extends Thread {
          
              private HostInfo hInfo;
              private Map jobs;

              /** Creates a new instance of Timer */
              public Timer(HostInfo hInfo) {
                  this.hInfo = hInfo;
                  this.jobs = new HashMap();
                  UUID uuid = UUID.randomUUID();
                  jobs.put(uuid, uuid);
              }

              private void showJobs() {
                  String[] str = new String[jobs.size()];
                  Iterator iter = jobs.keySet().iterator();
                  int i = 0;
                  while (iter.hasNext()) {
                      UUID uuid = (UUID) iter.next();
                      str[i] = uuid.toString();
                      i++;
                  }
                  hInfo.setJobs(str);
              }

              public void run() {
                  try {
                      Thread.sleep(10000); // 10 seconds
                      showJobs();
                  }
                  catch(Exception e) {

                  }
              }
          }
          
          private Timer timer;
          
          /** Creates new form Executor */
          public HostInfo() {
              initComponents();
              String[] jobs = new String[5];
              for(int i = 0; i < jobs.length; i++) {
                  UUID uuid = UUID.randomUUID();
                  jobs[i] = uuid.toString();
              }
              setJobs(jobs);
              timer = new Timer(this);
              timer.start();
          }
              
          public void setJobs(String[] jobs) {
              System.out.println("Setting job list: " + jobs.length);
              listJobs.setListData(jobs);
          }
              
          // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
          private void initComponents() {
              jPanel2 = new javax.swing.JPanel();
              jScrollPane1 = new javax.swing.JScrollPane();
              listJobs = new javax.swing.JList();
              jPanel1 = new javax.swing.JPanel();
              jButton1 = new javax.swing.JButton();

              setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
              setTitle("HostInfo");
              setName("frameExecutor");
              jPanel2.setLayout(new java.awt.BorderLayout());

              jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Jobs"));
              jPanel2.setPreferredSize(new java.awt.Dimension(396, 200));
              listJobs.setFont(new java.awt.Font("Dialog", 0, 12));
              jScrollPane1.setViewportView(listJobs);

              jPanel2.add(jScrollPane1, java.awt.BorderLayout.CENTER);

              jButton1.setText("View");
              jPanel1.add(jButton1);

              jPanel2.add(jPanel1, java.awt.BorderLayout.SOUTH);

              getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);

              java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
              setBounds((screenSize.width-413)/2, (screenSize.height-202)/2, 413, 202);
          }// </editor-fold>
          
         
          // Variables declaration - do not modify
          private javax.swing.JButton jButton1;
          private javax.swing.JPanel jPanel1;
          private javax.swing.JPanel jPanel2;
          private javax.swing.JScrollPane jScrollPane1;
          private javax.swing.JList listJobs;
          // End of variables declaration
          

          public static void main(String[] args) {
              HostInfo host = new HostInfo();
              host.setVisible(true);
          }
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: