I'm doing a window aplication. I need to create a JScrollPane and then fill it with a String[]. The problem is that I need to refresh it.
I want an empty JScrollPane when I start the aplication and when I press any button, the button will refresh the JScrollPane.
I have all the code, I only need refresh the content:
// Empty JScrollPane
scrollPaneDic = new JScrollPane(new JList());
scrollPaneDic.setBounds(225, 75, 200, 170);
// Layout
frame.getContentPane().setLayout(null);
frame.getContentPane().add(lblPalabrasDiccionario);
frame.getContentPane().add(scrollPaneDic);
And in the button actionListener is where I have to refresh the content:
String[] newContent = (method generate and return the new array);
listDic = new JList(newContent);
scrollPaneDic = new JScrollPane(listDic);
Important: scrollPaneDic and listDic are global
Thanks