public void selectSpears() throws IOException {
FXMLLoader loader = new FXMLLoader(
JBot.class.getResource("Select.fxml"));
AnchorPane selectDialog = (AnchorPane) loader.load();
final Stage stage = new Stage();
stage.initStyle(StageStyle.TRANSPARENT);
Scene scene = new Scene(selectDialog);
stage.setScene(scene);
stage.setOpacity(0.1);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
stage.setWidth(screenSize.getWidth());
stage.setHeight(screenSize.getHeight());
stage.show();
scene.setOnMousePressed(new EventHandler<MouseEvent>() {
public void handle(MouseEvent me) {
spearX = (int) me.getScreenX();
spearY = (int) me.getScreenY();
spearDelay = Integer.parseInt(delay.getText());
prop.setProperty("foodX", Integer.toString(spearX));
prop.setProperty("foodY", Integer.toString(spearY));
if (delay.getText() != null || delay.getText().equalsIgnoreCase("")); {
prop.setProperty("spearDelay", delay.getText());
}
try {
prop.store(new FileOutputStream("config.properties"), null);
stage.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}