Question: How to display a simple ListView in Java? Could you please give me a simple sample code on how to create ListView?

Answer: 
Do you mean [JList](http://www.google.com.sa/url?sa=t&rct=j&q=JList&source=web&cd=2&ved=0CDMQFjAB&url=http://docs.oracle.com/javase/6/docs/api/javax/swing/JList.html&ei=exAiT8zzAtHQsgaN6OnJDg&usg=AFQjCNHF2QzUAhmLWN7mxTNHeggj4Kx-Lw&sig2=s0W7wJlH-RljBZb58xXKLw)?, see java tutorials: [How to Use Lists](http://docs.oracle.com/javase/tutorial/uiswing/components/list.html)
Have a look at [Java swing tutorial](http://docs.oracle.com/javase/tutorial/ui/overview/demo.html) and [ListView](http://docs.oracle.com/javase/1.5.0/docs/api/javax/swing/text/html/ListView.html) API reference - Its an implementation of `<html>` list - `<ol><li>`. 

Sample :

```
public class Sample extends JFrame   {
    public Sample(){
        JEditorPane pane = new JEditorPane();
        pane.setContentType("text/html");
        pane.setText("<ol id='foo'><li>One</li><li>Two</li></ol>"); 
        HTMLDocument doc = (HTMLDocument) pane.getDocument();
        add(pane);

        //Get the ref of foo element
        Element ele=doc.getElement("foo");
        ListView view=new ListView(ele);
        System.out.println(ele.getElementCount());
        try{
             doc.insertBeforeEnd(ele.getElement(0), "<ul><li>Test");          
        }catch(Exception ex){}
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(300,300);
        setVisible(true);
    }
}

```