Commit cc0c08da authored by Stefan Michel's avatar Stefan Michel

- methoden koennen jetzt ueber das contextmenu ausgefuehrt werden.

parent 12fac19f
......@@ -17,6 +17,7 @@ import model.Terrain;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.nio.file.Files;
......@@ -132,6 +133,15 @@ public class MainViewCreationFX extends VBox {
result.append(")");
MenuItem menuItem = new MenuItem(result.toString());
menuItem.setOnAction(event -> {
try {
method.invoke(terrain.getHamster());
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
});
if (method.getParameterCount() > 0)
menuItem.setDisable(true);
contextMenu.getItems().add(menuItem);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment