- Thread Author
- #1
I'm in the process of making a very simple bot and wanted to add a ui so I noticed that in the api EmbeddableUI uses JavaFX. There isn't much info about the class in the docs though so I started reading about Javafx and looked around through a few open source bots and have a few questions.
1) Normally in JavaFX for your class, you have to extend Application and you have a start method where you can set the stage and scene. I guess EmbeddableUI already extends Application but I cant seem to find an example where it sets the stage or scene.
2) What exactly does the botInterfaceProperty as an ObjectProperty do? Reading through the Javafx api which is kind of confusing for a newbie, it looks like javafx uses special properties instead of regular fields I'm guessing for some sort of additional functionality?
3) For the FXMLloader, why does Runemate use its own Resource class to get the fxml file? It also looks like loading the fxml file is very different.
For example, when looking at examples of javafx programs on the web, this is what normally comes up.
but in Runemate it would be something like:
1) Normally in JavaFX for your class, you have to extend Application and you have a start method where you can set the stage and scene. I guess EmbeddableUI already extends Application but I cant seem to find an example where it sets the stage or scene.
2) What exactly does the botInterfaceProperty as an ObjectProperty do? Reading through the Javafx api which is kind of confusing for a newbie, it looks like javafx uses special properties instead of regular fields I'm guessing for some sort of additional functionality?
3) For the FXMLloader, why does Runemate use its own Resource class to get the fxml file? It also looks like loading the fxml file is very different.
For example, when looking at examples of javafx programs on the web, this is what normally comes up.
Code:
@Override
public void start(Stage stage) throws Exception
{
Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
but in Runemate it would be something like:
Code:
public ObjectProperty<Node> botInterfaceProperty()
{
if (botInterfaceProperty == null)
{
FXMLLoader loader = new FXMLLoader();
try
{
Node node = loader.load(Resources.getAsStream("com/juggy3/bots/bones_burier_bot/BoneBurier.fxml"));
botInterfaceProperty = new SimpleObjectProperty<>(node);
}
catch(Exception e)
{
e.printStackTrace();
}
}
return botInterfaceProperty;
}
Last edited: