I've been trying to figure out how to use JList and I cant seem to get it to display an object into my GUI.
there's a class called Drawing that I'm trying to add to the JList and it just doesnt seem to show.. Any help would be greatly appreciated
here's my code:
public class DrawingDisplayer extends JPanel implements ActionListener, ListSelectionListener {
JLabel title;
JButton draw,pause,clear,
        open,close,
        lines,background;
JSlider speedSlider;
JProgressBar progress;
Drawing drawing;
JFileChooser chooser;
JList fileList;
DefaultListModel listModel; 
JPanel drawPanel;
JScrollPane scrollPane;
public DrawingDisplayer(){
    title = new JLabel("The Drawing Displayer");
    title.setHorizontalAlignment(JLabel.CENTER);
    title.setFont(new Font("Serif", Font.BOLD, 24));
    draw = new JButton("Draw");
    pause = new JButton("Pause");
    clear = new JButton("Clear");
    speedSlider = new JSlider();
    progress = new JProgressBar();
    open = new JButton("Open Drawing");
    close = new JButton("Close Drawing");       
    listModel = new DefaultListModel();     
    fileList = new JList(listModel);
    fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    fileList.addListSelectionListener(this);
    fileList.setVisibleRowCount(10);
    scrollPane = new JScrollPane(fileList);
    scrollPane.setPreferredSize(new Dimension(200,250));
    lines = new JButton("Lines");
    background = new JButton("Background");
    setLayout(new BorderLayout());      
    //Draw Panel
    drawPanel = new JPanel();
    drawPanel.setBorder(BorderFactory.createTitledBorder("Drawing Area"));
    //Drawing Speed
    JPanel drawSpeed = new JPanel();        
        drawSpeed.setPreferredSize(new Dimension(300,200));
        drawSpeed.setBorder(BorderFactory.createTitledBorder("Drawing Speed"));
        drawSpeed.add(draw);
        drawSpeed.add(pause);
        drawSpeed.add(clear);
        drawSpeed.add(speedSlider);
        drawSpeed.add(progress);
    //File Options
    JPanel fileOptions = new JPanel();
        fileOptions.setPreferredSize(new Dimension(300,350));
        fileOptions.setBorder(BorderFactory.createTitledBorder("File Options"));
        open.addActionListener(this);
        close.addActionListener(this);
        fileOptions.add(open);
        fileOptions.add(close);
        fileOptions.add(fileList);
        fileOptions.add(scrollPane);
    //Colour Options.
    JPanel colourOptions = new JPanel();        
        colourOptions.setPreferredSize(new Dimension(300,200));
        colourOptions.setBorder(BorderFactory.createTitledBorder("Colour Options"));
        colourOptions.add(lines);
        colourOptions.add(background);
    //Control Panel
    JPanel controlPanel = new JPanel();
        controlPanel.setPreferredSize(new Dimension(325,200));
        controlPanel.add(drawSpeed);
        controlPanel.add(fileOptions);
        controlPanel.add(colourOptions);
        chooser = new JFileChooser(".");
    add(title, BorderLayout.NORTH);
    add(controlPanel,BorderLayout.WEST);
    add(drawPanel,BorderLayout.CENTER);
}
    public void actionPerformed(ActionEvent e) {
            if(e.getSource() == open){
                chooser = new JFileChooser(".");
                if(chooser.showOpenDialog(null) == chooser.APPROVE_OPTION){
                        drawing = new Drawing(chooser.getSelectedFile());
                        fileList.add(drawing);
                        listModel.addElement("test");
                }
            }
            else if (e.getSource() == close){
            }
        }
    public void valueChanged(ListSelectionEvent e) {
    }
public static void main(String[] args){
    DrawingDisplayer panel = new DrawingDisplayer();
    JFrame frame = new JFrame("drawing");
    frame.getContentPane().add(panel);      
    frame.pack();
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

 
     
     
    