Start New Discussion within our Software Development Community
public class J_01_FLOW_08 extends JApplet implements ActionListener
{
    String s_value[]={"white sox","red sox","mets","cordianls","blue jays"};
    JList l_list = new JList(s_value);

    JLabel l_label = new JLabel();


    Container c;
    FlowLayout flow = new FlowLayout();


    public void init()
    {
        c = getContentPane();
        c.setLayout(flow);

        c.add(l_list);
        c.add(b);

        l_list.addActionListener(this);
    }


    public void actionPerformed(ActionEvent e) 
    {
        String pick = l_list.getSelectedItem().toString();

        if(l_list.isSelected() == true) 
            l_label.setText(pick);
        }
}

getting error at

l_list.addActionListener(this);




String pick = l_list.getSelectedItem().toString();






 if(l_list.isSelected() == true) 

i dont know how to fix this

You fix it by looking at the API documentation for JList and using method names that are documented there. You didn't post the error messages like you should, but each of those 3 lines tries to call a method that doesn't exist for JList. You can't just guess or make up methoid names for API classes.

This question has already been answered. Start a new discussion instead.