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

Choice removeAll will make its newly added content unvisible.

    XMLWordPrintable

Details

    • sparc
    • solaris_2.6

    Description

      JDK: 1.2.2 D
      OS: Solaris 2.6
      Locale: C, zh_CN

      In this build, when using CHoice's removeAll method to remove its content, then
      add new item in it, the newly added items will not be visible.
      Following is a program to reproduce it.

      ===========================CheckChoice.java===================================
      import java.awt.*;
      import java.awt.event.*;
      import java.io.*;

      public class CheckChoice extends Thread {
         
         Choice choice1;
         Choice choice2;
         Choice choice3;
         int itemCount = 0;
         static CheckChoice choiceThread;

         public static void main(String args[]) {
             choiceThread = new CheckChoice();
             choiceThread.start();
         }

         public CheckChoice() {
             Frame f = new Frame("Check Choice");
             f.setLayout(new BorderLayout());
             choice1 = new Choice();
             choice2 = new Choice();
             choice3 = new Choice();
             f.add(choice1, BorderLayout.NORTH);
             f.add(choice3, BorderLayout.CENTER);
             f.add(choice2, BorderLayout.SOUTH);
             f.pack();
             f.show();
         }

         public void run() {
             while (true) {
             if (choice1 != null && itemCount < 40) {
                 choice1.add("I am Choice, yes I am : " + itemCount * itemCount);
                 choice2.add("I am the same, yes I am : "+ itemCount * itemCount);
                 choice3.add("I am the same, yes I am : "+ itemCount * itemCount);
                 itemCount ++;
             }
             if (itemCount >= 20 && choice1 != null && choice1.getItemCount() > 0) {
                 choice1.removeAll();
                 choice2.removeAll();
                 choice3.removeAll();
                 itemCount = 0;
             }
             //System.out.println("iiiiiiiii " + itemCount);
             try {
                 Thread.sleep(1000);
             } catch (Exception ex) {
             }
             }
          }
      }
      ===============================================================================

      run this program, wait several minutes to see its performance.


      jim.hu@prc 1999-01-25

      Attachments

        Activity

          People

            bchristi Brent Christian
            jhusunw Jim Hu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: