这是似乎有缺陷的AddList代码

时间:2019-03-09 18:18:28

标签: javascript html windows macos add

我之前曾问过这个问题:Code that works on Windows Laptops but not on Mac for some reason。在查看了评论之后,似乎我应该将AddList的代码与此问题一同发布。这是AddList的代码

public List addList(String words,int left, int top, int width, int height, ItemListener listener)
   {
       List newComp = new List();
       while (words.length()>0)
       { int s = words.indexOf("|");
         if (s<0)
         { newComp.add(words);
           words = "";
         }
         else
         { newComp.add(words.substring(0,s));
           words = words.substring(s+1);
         }
       }
       add(newComp);
       newComp.setBounds(left,top,width,height);
       if (listener!=null)newComp.addItemListener(listener);
       return newComp;
   }

0 个答案:

没有答案