How to clear a JList in Java?

There are number of problems, the first been that your example is full of compile problems, so I hope that's not your actual code.

JList does not have static method called setListData. I think you mean jList1 instead.

Each time you click on the clean button, you are creating a new model and component...

private void jButtonClearActionPerfomed(java.awt.event.ActionEvent evt)
{
    // ??
    DefaultListModel listmodel=new DefaultListModel();
    jList1 = new JList(listmodel);
    // ??
    if(evt.getSource()==jButtonClear) jList1.setListData(new String[0]);
    else listmodel.removeAllElements();
}

You've successfully dereferenced what ever jList1 was pointing at, so any time you try and interact with it, you're no longer interacting with the component on the screen.

The other problem is you supplying a empty array to the setListData method, which basically is like saying, "please add nothing to my list"

Try something like this;

private void jButtonClearActionPerfomed(java.awt.event.ActionEvent evt)
{
    DefaultListModel listmodel = (DefaultListModel)jList1.getModel();
    if(evt.getSource()==jButtonClear) {
        listmodel.removeAllElements();
    } else {
        listModel.addElement(new String[]{"Hello"});
    }
}

You should not be reinitializing the entire JList widget just to remove some items from it. Instead you should be manipulating the lists model, since changes to it are 'automatically' synchronized back to the UI. Assuming that you are indeed using the DefaultListModel, this is sufficient to implement your 'Clear All' functionality:

private void jButtonClearActionPerfomed(java.awt.event.ActionEvent evt) {
    if(evt.getSource()==jButtonClear) {
        DefaultListModel listModel = (DefaultListModel) jList1.getModel();
        listModel.removeAllElements();
    }
}

try this:

DefaultListModel model = new DefaultListModel();
model.clear();
jList1.setModel(model);