libVirt を使用してアクティブな仮想マシンのリストを作成し、コンボ ボックスに入力しようとしています 残念ながら、何か問題があります
public ArrayList<String> getActiveVirtualMachines() throws LibvirtException
{
int[] vmsOn = connect.listDomains();
Domain array=null;
vmsWl.clear();
System.out.println("List of running vms: ");
for (int i = 0; i < vmsOn.length; i++)
{
array = connect.domainLookupByID(vmsOn[i]);
vmsWl.add(array.getName());
}
for (int i = 0; i < vmsWl.size(); i++) {
System.out.println(vmsWl);
}
return vmsWl;
}
リストは次のようになります。
実行中の VM のリスト:
[Ubuntu、testNew2]
[Ubuntu、testNew2]
対照的に: 実行中の VM のリスト:
Ubuntu
testNew2
そして、コンボボックスと同じ話で、2つの同一のエントリがあります:
[Ubuntu、testNew2] [Ubuntu、testNew2]