/** * This method is used to add delete listeners for {@link StateRepresentation} in the GUI. * * @param s The {@link StateRepresentation} to which the delete listener is added. */ private void addDeleteStateListener(StateRepresentation s) { s.getDeleteButton() .addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { s.getContainerVBox().remove(s.getStateUriLabel()); s.getContainerVBox().remove(s.getStateUriTextField()); s.getContainerVBox().remove(s.getStateNameLabel()); s.getContainerVBox().remove(s.getStateNameTextField()); s.getContainerVBox().remove(s.getStateValueLabel()); s.getContainerVBox().remove(s.getStateValueTextField()); s.getContainerVBox().remove(s.getDeleteButton()); s.getContainerVBox().remove(s.getHorizontalLine()); s.getContainerVBox().revalidate(); s.getContainerVBox().revalidate(); listOfStateRepresentations.remove(s); } }); }