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

ChoiceList becomes a thin line after "stress"

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

            choice.addItem("-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859
      -1");
              choice.addItem("-adobe-courier-medium-r-normal--14-100-100-100-m-90-iso88
      59-1");
              choice.addItem("-adobe-courier-medium-r-normal--14-140-75-75-m-90-iso8859
      -1");
              choice.addItem("-adobe-courier-medium-r-normal--17-120-100-100-m-100-iso8
      859-1");
              choice.addItem("-adobe-courier-medium-r-normal--18-180-75-75-m-110-iso885
      9-1");
              choice.addItem("-adobe-courier-medium-r-normal--20-140-100-100-m-110-iso8
      859-1");
              choice.addItem("-adobe-courier-medium-r-normal--24-240-75-75-m-150-iso885
      9-1");
              choice.addItem("-adobe-courier-medium-r-normal--25-180-100-100-m-150-iso8
      859-1");
              choice.addItem("-adobe-courier-medium-r-normal--34-240-100-100-m-200-iso8
      859-1");
              choice.addItem("-adobe-courier-medium-r-normal--8-80-75-75-m-50-iso8859-1
      ");
              choice.addItem("-adobe-helvetica-bold-i-normal--0-0-0-0-p-0-iso8859-1");
              choice.addItem("-adobe-helvetica-bold-o-normal--0-0-100-100-p-0-iso8859-1
       ");
              choice.addItem("-adobe-helvetica-bold-o-normal--0-0-75-75-p-0-iso8859-1")
      ;
              choice.addItem("-adobe-helvetica-bold-o-normal--10-100-75-75-p-60-iso8859
      -1");
              choice.addItem("-adobe-helvetica-bold-o-normal--11-80-100-100-p-60-iso885
      9-1");
              choice.addItem("-adobe-helvetica-bold-o-normal--12-120-75-75-p-69-iso8859
      -1");
              choice.addItem("-adobe-helvetica-bold-o-normal--14-100-100-100-p-82-iso88
      59-1");
              choice.addItem("-adobe-helvetica-bold-o-normal--14-140-75-75-p-82-iso8859
      -1");
              choice.addItem("-adobe-helvetica-bold-o-normal--17-120-100-100-p-92-iso88
      59-1");
              choice.addItem("-adobe-helvetica-bold-o-normal--18-180-75-75-p-104-iso885
      9-1");
              return choice;
           }
        }
        
        class choiceChoice implements ItemListener {
        
          public void itemStateChanged(ItemEvent e) {
                    
            dump.setText("Choice list item "+choice.getSelectedItem()+" at index "+choi
      ce.getSelectedIndex()+" has been selected.");
            
          }
        }

      }
            

      Run the script C.csh

      jtg-i105% /net/ultrajaguar/export/jdk12x/intel/jdk1.2FCS_O/bin/java -fullversion
      java full version "JDK-1.2fcs-O"

      #!/bin/csh
      setenv LD_LIBRARY_PATH /usr/dt/lib:/usr/openwin/lib:/net/ultrajaguar/export/testbase/src/JCK-12a/lib/intel
      setenv CLASSPATH /net/ultrajaguar/export/testbase/src/JCK-12a/classes:/net/ultrajaguar/export/testbase/src/JCK-12a/javatest.jar
      /net/ultrajaguar/export/jdk12x/intel/jdk1.2FCS_O/bin/java -verify javasoft.sqe.tests.api.java.awt.interactive.TestApplet javasoft.sqe.tests.api.java.awt.interactive.ChoiceTest -TestCaseID ALL

      problem1:
      reproducible steps
       press "stress"

      The choice list becomes a thin line.

      problem2:
      reproducible steps
      1. press "stress"
      2. press "set to initial state" and then click on the choice list,

        
      Originally the items "one two three four five six" are displayed vertically in
      a single column, but after the above two steps, they are displayed in two rows
      and three columns, with "one three five" in the first row and "two four six" in
      the second row.

      problem2 is fixed in javasoft FCS_O

      june.zhong@eng 1998-10-28


      ==============
      Stand-alone test case:

      import java.applet.Applet;
      import java.awt.*;
      import java.awt.event.*;

      /**
       * A test of Choice components.
       */
      public class ChoiceTest extends Applet {
          class AppendableTextField extends TextField {
                public void append(String s) {
                      setText(getText() + s);
            }
              }
              AppendableTextField dump = new AppendableTextField();
              Frame f;
          Choice choice;
          Panel p;
          TextField name, index;
          String[] items = {"one", "two", "three", "four", "five", "six"};
          String scr = "This is an interactive test for class java.awt.Choice."+
          "\nShown below on the left is a choice list. Each of the seven buttons "+
          "in the center performs an action on the choice list. The Add, Remove, "+
          "Insert, and Select buttons require a name and/or index to be specified."+
          "Please use the buttons in the center and verify that the choice list is "+
          "is updated accordingly, and that the status presented in the Status area "+
          "is correct. The \"Show Status\" button should be used to get the current "+
          "status of the choice list."+
          "\nPress Yes in case of correct behavior, No otherwise.";

         public ChoiceTest(Frame f) { this.f = f; }
         /* Test interface */
          public void init() {

         /* Test interface */
            // Set title of test frame
              f.setTitle("ChoiceTest");
              dump.setText("");

           // Construct test panel
              setLayout(new BorderLayout());
              choiceButton listener = new choiceButton();
          
              p = new Panel();
              p.setLayout(new GridLayout(2,0));
              choice = new Choice();
              choice.addItemListener( new choiceChoice());
              for(int i=0;i<items.length;i++) {
                choice.addItem(items[i]);
              };
              p.add(new Label("TestChoice"));
              p.add(choice);
              add("West", p);

              p = new Panel();
              p.setLayout(new GridLayout(7,0,10,10));
              Button b_add = new Button("Add");
              b_add.addActionListener(listener);
              p.add(b_add);
              Button b_remove = new Button("Remove");
              b_remove.addActionListener(listener);
              p.add(b_remove);
              Button b_insert = new Button("Insert");
              b_insert.addActionListener(listener);
              p.add(b_insert);
              Button b_select = new Button("Select");
              b_select.addActionListener(listener);
              p.add(b_select);
              Button b_removeAll = new Button("RemoveAll");
              b_removeAll.addActionListener(listener);
              p.add(b_removeAll);
              Button stress = new Button("Stress");
              stress.addActionListener(listener);
              p.add(stress);
              Button reset = new Button("Reset to initial state");
              reset.addActionListener(listener);
              p.add(reset);
              add("Center", p);
              
              p = new Panel();
              p.setLayout(new GridLayout(4,0));
              p.add(new Label("NAME", Label.CENTER));
              p.add(name = new TextField(""));
              p.add(new Label("INDEX", Label.CENTER));
              p.add(index = new TextField(""));
              add("East", p);

              Button b_dump = new Button("Show Status");
              b_dump.addActionListener(listener);
              add("South", b_dump);
          }

        /* Standalone interface */
          public static void main(String args[]) {
              Frame f = new Frame("ChoiceTest");
              ChoiceTest choiceTest = new ChoiceTest(f);

              choiceTest.init();
              choiceTest.start();

              f.add("Center", choiceTest);
              f.setVisible(true);
          }

        class choiceButton implements ActionListener {
       
           public void actionPerformed(ActionEvent e) {
             String nameb = e.getActionCommand();

             if(nameb.equals("Add")) {
              if(!name.getText().trim().equals("")) {
               try {
                 dump.setText("New choice list item "+name.getText()+" has been added a
      t index "+choice.getItemCount()+ ".");
                 choice.add(name.getText());
               } catch(NullPointerException e1) {
                dump.setText(e1 + " is thrown");
               };
              } else dump.setText("Please enter name of item to add.");
             };
             
             if(nameb.equals("Remove")) {
               try {
                 int ind = Integer.valueOf(index.getText()).intValue();
                 choice.remove(ind);
                 dump.setText("Choice list item "+choice.getItem(ind)+" at index "+ind+
      " has been removed.");
               } catch (Exception e2) {
                 try {
                  if(!name.getText().trim().equals("")) {
                   int ind2 = 0;
                   for(int i=0;i<choice.getItemCount();i++)
                      if(choice.getItem(i).equals(name.getText())) {
                          ind2 = i;
                          i = choice.getItemCount();
                      };
                   choice.remove(name.getText());
                   dump.setText("Choice list item "+name.getText()+" at index "+ind2+"
      has been removed.");
                  } else dump.setText("Please enter either name or valid index of item
      to remove.");
                 } catch (Exception e3) {
                   dump.setText(e3 + " is thrown");
                 };
               };
             };
             if(nameb.equals("Insert")) {
              if(!name.getText().trim().equals("")) {
               try {
                 int ind = Integer.valueOf(index.getText()).intValue();
                 try {
                   choice.insert(name.getText(), ind);
                   if(ind>choice.getItemCount()+1) ind=choice.getItemCount()-1;
                   dump.setText("Choice list item "+name.getText()+" has been inserted
      at index "+ind+ ".");
                 } catch (IllegalArgumentException e4) {
                  dump.setText(e4 + " is thrown");
                 } catch(ArrayIndexOutOfBoundsException E1) {
                   dump.setText("ArrayIndexOutOfBoundsException has been thrown");
                 };
               } catch (Exception e5) {
                 dump.setText("Please enter index value of item to be inserted.");
               };
              } else dump.setText("Please enter name of item to be inserted.");
             };
             
             if(nameb.equals("Select")) {
               try {
                 int ind = Integer.valueOf(index.getText()).intValue();
                 try {
                   choice.select(ind);
                   dump.setText("Choice list item "+choice.getSelectedItem()+" at index
       "+choice.getSelectedIndex()+" has been selected.");
                 } catch (IllegalArgumentException e6) {
                   dump.setText(e6 + " is thrown");
                 } catch (ArrayIndexOutOfBoundsException E2) {
                   dump.setText(E2+" has been thrown");
                 };
               } catch (Exception e7) {
                if (!name.getText().trim().equals(""))
                 choice.select(name.getText());
                 else dump.setText("Please enter either name or valid index of item to
      select.");
               };
             };
             
             if(nameb.equals("RemoveAll")) {
               choice.removeAll();
               dump.setText("All items from choice list have been removed.");
             };
             
             if(nameb.equals("Stress")) {
               choice.removeAll();
               choice = stressChoice(choice);
               nameb = "Show Status";
             };

             if(nameb.equals("Reset to initial state")) {
              choice.removeAll();
              name.setText("");
              index.setText("");
              for(int i=0;i<items.length;i++) {
                choice.addItem(items[i]);
              };
              dump.setText("Choice list has been reset to initial state.");
              dump.append("\nNumber of items in choice list: "+choice.getItemCount());
              dump.append("\nList of items: ");
              for(int i=0;i<choice.getItemCount();i++)
                 dump.append("\n"+i+": "+choice.getItem(i));
             };

             if(nameb.equals("Show Status")) {
               dump.setText("------- Status for choice -------");
               dump.append("\nNumber of items in choice list: "+choice.getItemCount());
               if (choice.getItemCount()>0) {
                   dump.append("\nSelected item: "+choice.getSelectedItem()+" at index
      "+choice.getSelectedIndex());
                   dump.append("\nList of all items: ");
                   for(int i=0;i<choice.getItemCount();i++) {
                     dump.append("\n"+i+": "+choice.getItem(i));
               };
               };
             };
           }
           
           Choice stressChoice(Choice choice) {
              choice.addItem("--courier-bold-o-normal--0-0-0-0-m-0-iso8859-1");
              choice.addItem("--courier-bold-r-normal--0-0-0-0-m-0-iso8859-1");
              choice.addItem("--courier-medium-o-normal--0-0-0-0-m-0-iso8859-1");
              choice.addItem("--courier-medium-r-normal--0-0-0-0-m-0-iso8859-1");
              choice.addItem("--symbol-medium-r-normal--0-0-0-0-p-0--symbol");
              choice.addItem("--symbol-medium-r-normal--0-0-0-0-p-0-sun-fontspecific");
              choice.addItem("This is the fonts list to test the length of each choice
      item string as well as the number of such strings list in the choice menu. This t
      est is a good stress test for such methods that take a string as an argument. The
      re are about 82 items in this list.");
              choice.addItem("-adobe-courier-bold-i-normal--0-0-0-0-m-0-iso8859-1");
              choice.addItem("-adobe-courier-bold-o-normal--0-0-100-100-m-0-iso8859-1")
      ;
              choice.addItem("-adobe-courier-bold-o-normal--0-0-75-75-m-0-iso8859-1");
              choice.addItem("-adobe-courier-bold-o-normal--0-0-75-75-m-0-iso8859-1");
              choice.addItem("-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-1
      ");
              choice.addItem("-adobe-courier-bold-o-normal--11-80-100-100-m-60-iso8859-
      1");
              choice.addItem("-adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1
      ");
              choice.addItem("-adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1
      ");
              choice.addItem("-adobe-courier-bold-o-normal--14-100-100-100-m-90-iso8859
      -1");
              choice.addItem("-adobe-courier-bold-o-normal--14-140-75-75-m-90-iso8859-1
      ");
              choice.addItem("-adobe-courier-bold-o-normal--17-120-100-100-m-100-iso885
      9-1");
              choice.addItem("-adobe-courier-bold-o-normal--18-180-75-75-m-110-iso8859-
      1");
              choice.addItem("-adobe-courier-bold-o-normal--20-140-100-100-m-110-iso885
      9-1");
              choice.addItem("-adobe-courier-bold-o-normal--24-240-75-75-m-150-iso8859-
      1");
              choice.addItem("-adobe-courier-bold-o-normal--25-180-100-100-m-150-iso885
      9-1");
              choice.addItem("-adobe-courier-bold-o-normal--34-240-100-100-m-200-iso885
      9-1");
              choice.addItem("-adobe-courier-bold-o-normal--8-80-75-75-m-50-iso8859-1")
      ;
              choice.addItem("-adobe-courier-bold-r-normal--0-0-0-0-m-0-iso8859-1");
              choice.addItem("-adobe-courier-bold-r-normal--0-0-100-100-m-0-iso8859-1")
      ;
              choice.addItem("-adobe-courier-bold-r-normal--0-0-75-75-m-0-iso8859-1");
              choice.addItem("-adobe-courier-bold-r-normal--0-0-75-75-m-0-iso8859-1");
              choice.addItem("-adobe-courier-bold-r-normal--10-100-75-75-m-60-iso8859-1
      ");
              choice.addItem("-adobe-courier-bold-r-normal--11-80-100-100-m-60-iso8859-
      1");
              choice.addItem("-adobe-courier-bold-r-normal--12-120-75-75-m-70-iso8859-1
      ");
              choice.addItem("-adobe-courier-bold-r-normal--12-120-75-75-m-70-iso8859-1
      ");
              choice.addItem("-adobe-courier-bold-r-normal--14-100-100-100-m-90-iso8859
      -1");
              choice.addItem("-adobe-courier-bold-r-normal--14-140-75-75-m-90-iso8859-1
      ");
              choice.addItem("-adobe-courier-bold-r-normal--17-120-100-100-m-100-iso885
      9-1");
              choice.addItem("-adobe-courier-bold-r-normal--18-180-75-75-m-110-iso8859-
      1");
              choice.addItem("-adobe-courier-bold-r-normal--20-140-100-100-m-110-iso885
      9-1");
              choice.addItem("-adobe-courier-bold-r-normal--24-240-75-75-m-150-iso8859-
      1");
              choice.addItem("-adobe-courier-bold-r-normal--25-180-100-100-m-150-iso885
      9-1");
              choice.addItem("-adobe-courier-bold-r-normal--34-240-100-100-m-200-iso885
      9-1");
              choice.addItem("-adobe-courier-bold-r-normal--8-80-75-75-m-50-iso8859-1")
      ;
              choice.addItem("-adobe-courier-medium-i-normal--0-0-0-0-m-0-iso8859-1");
              choice.addItem("-adobe-courier-medium-o-normal--0-0-100-100-m-0-iso8859-1
      ");
              choice.addItem("-adobe-courier-medium-o-normal--0-0-75-75-m-0-iso8859-1")
      ;
              choice.addItem("-adobe-courier-medium-o-normal--0-0-75-75-m-0-iso8859-1")
      ;
              choice.addItem("-adobe-courier-medium-o-normal--10-100-75-75-m-60-iso8859
      -1");
              choice.addItem("-adobe-courier-medium-o-normal--11-80-100-100-m-60-iso885
      9-1");
              choice.addItem("-adobe-courier-medium-o-normal--12-120-75-75-m-70-iso8859
      -1");
              choice.addItem("-adobe-courier-medium-o-normal--12-120-75-75-m-70-iso8859
      -1");
              choice.addItem("-adobe-courier-medium-o-normal--14-100-100-100-m-90-iso88
      59-1");
              choice.addItem("-adobe-courier-medium-o-normal--14-140-75-75-m-90-iso8859
      -1");
              choice.addItem("-adobe-courier-medium-o-normal--17-120-100-100-m-100-iso8
      859-1");
              choice.addItem("-adobe-courier-medium-o-normal--18-180-75-75-m-110-iso885
      9-1");
              choice.addItem("-adobe-courier-medium-o-normal--20-140-100-100-m-110-iso8
      859-1");
              choice.addItem("-adobe-courier-medium-o-normal--24-240-75-75-m-150-iso885
      9-1");
              choice.addItem("-adobe-courier-medium-o-normal--25-180-100-100-m-150-iso8
      859-1");
              choice.addItem("-adobe-courier-medium-o-normal--34-240-100-100-m-200-iso8
      859-1");
              choice.addItem("-adobe-courier-medium-o-normal--8-80-75-75-m-50-iso8859-1
      ");
              choice.addItem("-adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1");
              choice.addItem("-adobe-courier-medium-r-normal--0-0-100-100-m-0-iso8859-1
      ");
              choice.addItem("-adobe-courier-medium-r-normal--0-0-75-75-m-0-iso8859-1")
      ;
              choice.addItem("-adobe-courier-medium-r-normal--0-0-75-75-m-0-iso8859-1")
      ;
              choice.addItem("-adobe-courier-medium-r-normal--10-100-75-75-m-60-iso8859
      -1");
              choice.addItem("-adobe-courier-medium-r-normal--11-80-100-100-m-60-iso885
      9-1");
              choice.addItem("-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859
      -1");
        

        Attachments

          Activity

            People

            Assignee:
            prssunw Prs Prs (Inactive)
            Reporter:
            jzhongsunw June Zhong (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: