Use case: I am trying to xtract the arguments inside the parenthesis and populate it to a jList.
Input:
title(a1, a3)
Code:
static ArrayList variableList = new ArrayList();
Matcher m = Pattern.compile("\\(([^)]+)\\)").matcher(result.toString().trim());
while(m.find())
{
if (!variableList.contains(m.group(1).trim()))
{
variableList.add(m.group(1).trim());
}
}
DefaultListModel lista1 = new DefaultListModel();
for (int i = 0;i<variableList.size();i++)
{
if (!lista1.contains(variableList.get(i)))
{
lista1.addElement(variableList.get(i));
}
}
jList.setModel(lista1);
revalidate();
repaint();
Expected Output in jList:
Code Output:
The error is instead of populating the list vertically, it gets appended as a group. Please suggest me on how to rectify this.

