HI Stephan:

I am including some sample code, to see the results,
all you need to is:

1) copy file to a directory in your classpath
   and name the file DDTest.java
2) compile the source , i.e.,  javac DDTest.java
3) run the program,    java DDTest.java

You will see that the elements are out of order...
I want to be able to extract the elements in order
so I can add an option that says "Please Select a City"
as the FIRST element and then add the rest of the elements
in their original order.

Any insights, etc... would greatly be appreciated.

Many Thanks:

Alex Restrepo

-------CUT HERE---------------

import  org.apache.ecs.html.*;
import  java.util.*;

public class DDTest
{
    public static void main(String args[])
    {
        Select selectDD   = new Select("CITY");
        for (int i = 0; i < 20; i++)
        {
            Option option = new Option(String.valueOf(i));
            option.addElement("City " + i);
            selectDD.addElement(option);
        }
        System.out.println("---------Original List------");
        System.out.println(selectDD);
          System.out.println("----------------------------");        

        Select selectDD2  = new Select("CITY COPY");
        Vector temp       = new Vector();

        for (Enumeration en=selectDD.elements();en.hasMoreElements();)
        {
            temp.addElement(en.nextElement());
        }
        
        for (Enumeration en=temp.elements();en.hasMoreElements();) 
        {
            selectDD2.addElement((org.apache.ecs.Element)en.nextElement());
        }
        System.out.println("---------List Copy------");
        System.out.println(selectDD2);   
          System.out.println("----------------------------");        
    }
}

-----END: CUT HERE--------------------------

-----Original Message-----
From: Stephan Nagy [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 02, 2001 9:25 AM
To: [EMAIL PROTECTED]
Subject: Re: Adding element to the begiining of an selection list and
selecting an element by index


"RESTREPO, ALEXANDER G [Non-Pharmacia/1000]" wrote:

> Thanks for the code, it worked ...
> However, how do I maintain the order of the selection list?
> The code example Robert put together worked beautifully but my
> Selection List was out of order...

It shouldn't of been.  If it is then we've introduced a bug into the ecs src
tree.  The only portion of any ecs document tree whose order is arbitrary
are
the attributes associated with the elements.   If you would send me your
code
and what it output.

-stephan


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to