void (ActionMacro macro) { DefaultListModel<ActionMacro.ActionDescriptor> actionModel = new DefaultListModel<>(); final ActionMacro.ActionDescriptor[] actions = macro.getActions(); for (ActionMacro.ActionDescriptor action : actions) { actionModel.addElement(action); } myMacroActionsList.setModel(actionModel); ScrollingUtil.ensureSelectionExists(myMacroActionsList); }