Technical Documentation
Controllers
Before getting to the heart of the matter, let’s talk a little about FXML controllers JavaFX. What is a FXML controller?
An FXML controller is used to initialize UI components and manipulate to perform actions or things you can’t do with an FXML file.
However, an FXML controller is not required.
Warning
The FXML controllers of the system elements must be declared and do not need to be declared in their FXML file Respective because it is already done by the system.
Now let’s go over the basics that absolutely need Know before you get to the heart of the matter.
Initialization
If you need to initialize anything, you wantmanipulate a UI element declared in an attribute or that you wantPerform any operation, you can do it from this method:
@Override
public void initialize(URL location, ResourceBundle resources) {
myLabel.setText("Je suis le roi de la jungle !");
}
Annotation @FXML
To retrieve in your FXML controller a UI element declared in a FXML file, it must be done in the following way preceded by the FXML annotation and attribute name must be the FXML ID of the element to retrieve as follows:
In your controller you do like this:
@FXML
private Pane pane;
And in your FXML file like this:
<Pane fx:id="pane" />
You can then use the attribute to do whatever you want with it.
Let’s now get to the heart of the matter, namely what to define in the times in the system FXML controllers and in the FXML controllersMandatory to make your theme work like clockwork.
ApplicationController
Note
Quick reminder: If you remember correctly, Application is the itemParent of the system.
Creating the controller
The contents of your ApplicationController should look like this:
public class ApplicationController implements Initializable {
// Attributs récupérés par le système
private boolean doGameFilesInstallationBeforeRunGame = false;
private boolean doGameFilesInstallationFromLauncherUI = true;
private boolean isWindowMoveable = true;
private boolean isWindowMoveableOnOutScreen = true;
// Attributs injectés par le système
private boolean isStatutServerMCEnabled;
private boolean isNewsMLEnabled;
private boolean isSnowFlakeEnabled;
private boolean isRadioMLEnabled;
@Override
public void initialize(URL location, ResourceBundle resources) {
}
}
Retrieved attributes
Injected attributes
To date, there are only attributes to verify that the plugins are enabled. They shall have the following format:
private boolean boolean isNom_du_pluginEnabled;
You have to replace Nom_du_plugin with the name of the plugin that you want to check.
For example for the plugin NewsML it will be:
private boolean boolean isNewsMLEnabled;
These attributes will be useful for example to enable/disable tabs.
LauncherController
Creating the controller
The contents of your LauncherController should look like this:
public class LauncherController implements Initializable {
@Override
public void initialize(URL location, ResourceBundle resources) {
}
}
Retrieved attributes
No attributes are recovered at this time.
Injected attributes
No attributes are injected at the moment.
UpdaterController
Creating the controller
The contents of your LauncherController should look like this:
public class LauncherController implements Initializable {
@Override
public void initialize(URL location, ResourceBundle resources) {
}
}
Retrieved attributes
No attributes are recovered at this time.
Injected attributes
No attributes are injected at the moment.
LoadingController
Creating the controller
The contents of your LauncherController should look like this:
public class LauncherController implements Initializable {
@Override
public void initialize(URL location, ResourceBundle resources) {
}
}
Retrieved attributes
No attributes are recovered at this time.
Injected attributes
No attributes are injected at the moment.
ConnectionLostController
Creating the controller
The contents of your LauncherController should look like this:
public class LauncherController implements Initializable {
@Override
public void initialize(URL location, ResourceBundle resources) {
}
}
Retrieved attributes
No attributes are recovered at this time.
Injected attributes
No attributes are injected at the moment.
SettingsController
Creating the controller
This controller is declared by the system and is associated with the settings_template.fxml. It represents the launcher settings.
The contents of your SettingsController should look like this:
public class SettingsController implements Initializable {
private String settingsTabsBgColor = "#775637";
private String settingsTabsBgBorderColor = "#775637";
private String settingsTabsThemeColor = "#d4a15a";
private String settingsTabsInputsTextColor = "#775637";
private String settingsTabsTextColor = "#ffffff";
@Override
public void initialize(URL location, ResourceBundle resources) {
}
}
Retrieved attributes
Injected attributes
No attributes are injected at the moment.
FXML
application_ui.fxml
#app_container
Warning
This item is mandatory and must be declared in the file launcher-ui.fxml
This element represents the framework that we have seen in the structure of the system in a previous part. It will contain in its center all the system elements such as Launcher, Updater etc… Otherwisesaid, in app_container you will find the contents of the files launcher_ui.fxml, updater_ui.fxml etc… in turn.
Sample code:
<BorderPane fx:id="app_container />
It must be of type BorderPane.
#app_close_btn
Warning
This item is mandatory and must be declared in the file launcher-ui.fxml
This element terminates the system element Application and therefore close your theme.
Sample code:
<Button fx:id="app_close_btn />
It must be of type Button or inherit it.
#app_reduce_btn
Warning
This item is mandatory and must be declared in the file launcher-ui.fxml
This element minimizes your theme window.
Sample code:
<Button fx:id="app_reduce_btn />
It must be of type Button or inherit it.
#minelaunched_copyright_label
Warning
This item is mandatory and must be declared in the file launcher-ui.fxml
This item displays copyright. It is strictly forbidden to Bypass it or hide it under risk of making you permanentlyBlocked the account.
<Label fx:id="minelaunched_copyright_label />
It must be of the Label type or inherit it.
#progressBar
Warning
This element is mandatory provided that it is declared somewherein the application_ui.fxml file or in updater_ui.fxml
This item displays a progress bar of files in progressdownload.
Note
If it is located in the application_ui.fxml file then it does notmust not be declared in the updater_ui.fxml file. The Downloading files will therefore be visible on both sides of the System elements such as Launcher and Updater.
<ProgressBar fx:id="progressBar" />
It must be of the ProgressBar type or inherit it.
#progressBarLabel
Warning
This element is mandatory provided that it is declared somewherein the application_ui.fxml file or in updater_ui.fxml
This item displays the label of the files being downloaded.
Note
If it is located in the application_ui.fxml file then it does notmust not be declared in the updater_ui.fxml file. The wording will therefore be visible on both sides of the elements of the system such as Launcher and Updater.
<Label fx:id="progressBarLabel" />
It must be of the Label type or inherit it.
.snowflake
Warning
This element is required only if the SnowFlake plugin is compatible and is user-activated
In this element there will be a fall of snowflakes. So that the Flakes are in the background, you need to place this item in aStackPane as the first element.
<StackPane styleClass="snowflake" />
It must be of the StackPane type or inherit it.
#news_container
Warning
This element is mandatory only if the plugin is activated and itis compatible with your theme. You can declare it anywherein your application whether in application_ui.fxml or launcher_ui.fxml
This element will integrate the contents of the news_template.fxml file.
Sample code:
<ScrollPane fx:id="news_container" />
<Pane fx:id="news_container" />
It must be of type ScrollPane or Pane or inherit from oneof the 2 elements chosen.
#statutservermc_container
Warning
This element is mandatory only if the plugin is activated and itis compatible with your theme. You can declare it anywherein your application whether in application_ui.fxml or launcher_ui.fxml
This element will integrate the contents of the file**statutservermc_template.fxml**.
Sample code:
<ScrollPane fx:id="statutservermc_container" />
<Pane fx:id="statutservermc_container" />
It must be of the Pane type or inherit it.
launcher_ui.fxml
#microsoft_auth_container
Warning
This item is mandatory and must be declared in the file launcher-ui.fxml
This item is displayed when authentication to microsoft is enabledin the launcher. It must contain the #btn_submit_microsoft_auth to open the windowauthentication to Microsoft. It may also contain other What should be displayed for this authentication mode.
Sample code:
<Pane fx:id="microsoft_auth_container" />
<AnchorPane fx:id="microsoft_auth_container" />
<BorderPane fx:id="microsoft_auth_container" />
It must be of the Pane type or inherit it.
#btn_submit_microsoft_auth
Warning
This item is mandatory and must be declared in the file launcher-ui.fxml
This item opens the authentication window to microsoft. It must go to #microsoft_auth_container to be recognized by the system.
Sample code:
<AnchorPane fx:id="microsoft_auth_container">
<Button fx:id="btn_submit_microsoft_auth" />
</AnchorPane>
It must be of type Button or inherit it.
#custom_auth_container
Warning
This item is mandatory and must be declared in the file launcher-ui.fxml
This item is displayed when custom authentication is Enabled in the launcher. It must contain the field with the class .login, the field with the class .password and the ” butto**.submit_login** that is intended for this authentication mode. He can Also contain other items that should be displayed for this authentication mode.
Sample code:
<AnchorPane fx:id="custom_auth_container">
<TextField styleClass="login" />
<PasswordField styleClass="password" />
<Button styleClass="submit_login" />
</AnchorPane>
It must be of the Pane type or inherit it.
#crack_auth_container
Warning
This item is mandatory and must be declared in the file launcher-ui.fxml
This item is displayed when cracked authentication is enabled in the launcher. It must contain the field with the class .login, and the .submit_login button that is intended for this authentication mode.It may also contain other items that should be displayedfor this authentication mode.
Sample code:
<AnchorPane fx:id="crack_auth_container">
<TextField styleClass="login" />
<Button styleClass="submit_login" />
</AnchorPane>
It must be of the Pane type or inherit it.
.login
Warning
This element is mandatory and must be declared as a sub-element of Items mentioned above in the launcher-ui.fxml file
This element is a text field intended for the different modesauthentication.
Sample code:
<AnchorPane fx:id="crack_auth_container">
<TextField styleClass="login" />
</AnchorPane>
It must be of type TextField or inherit from it.
.password
Warning
This element is mandatory and must be declared as a sub-element of Items mentioned above in the launcher-ui.fxml file
This element is a hidden text field intended for the different modesauthentication. It is used to enter the password.
Sample code:
<AnchorPane fx:id="custom_auth_container">
<PasswordField styleClass="password" />
</AnchorPane>
Il doit être du type PasswordField ou en hériter.
.save_account_checkbox
Note
This element is optional and must be declared as a sub-element of Elements #custom_auth_container and #crack_auth_container citedhigher in launcher-ui.fxml file
Note
If this item is not declared, by default, the identifiers are memorized for a future connection.
This item is a check box that allows you to save login credentials for a future login.
Sample code:
<AnchorPane fx:id="custom_auth_container">
<CheckBox styleClass="save_account_checkbox" />
</AnchorPane>
It must be of the CheckBox type or inherit it.
#settings_container
Warning
This item is mandatory and must be declared in the file launcher_ui.fxml
This element will integrate the contents of the settings_template.fxml file.
Sample code:
<ScrollPane fx:id="settings_container" />
<Pane fx:id="settings_container" />
It must be of type ScrollPane or Pane or inherit from oneof the 2 elements chosen.
updater_ui.fxml
#progressBar
Warning
This element is mandatory provided that it is declared somewherein the application_ui.fxml file or in updater_ui.fxml
This item displays a progress bar of files in progressdownload.
Note
If it is located in the updater_ui.fxml file then it should notnot be declared in parallel in the application_ui.fxml file. The download files will therefore be visible only in the element constituting the updater_ui.fxml file.
<ProgressBar fx:id="progressBar" />
It must be of the ProgressBar type or inherit it.
#progressBarLabel
Warning
This element is mandatory provided that it is declared somewherein the application_ui.fxml file or in updater_ui.fxml
This item displays the label of the files being downloaded.
Note
If it is located in the updater_ui.fxml file then it should notNot be declared in the application_ui.fxml file. The wording will be so visible only in the element constituting the file updater_ui.fxml.
<Label fx:id="progressBarLabel" />
It must be of the Label type or inherit it.
loading_ui.fxml
Note
This file is optional.
If this file exists in the project, it will activate the Loading element of system (see system description for more information).
This file does not contain any mandatory elements at the moment butmust represent a loading window (e.g. With a loader)
connection_lost_ui.fxml
Note
This file is optional.
If this file exists in the project, it will activate the item ConnectionLost of the system (see system description Read more).
#connectionLostLabel
Warning
This element is required in the connection_lost_ui.fxml file
This item displays the connection resume counter.
<Label fx:id="connectionLostLabel" />
It must be of the Label type or inherit it.
settings_template.fxml
Note
The contents of this file are attached to the #settings_container element
This file acts as a template for displaying launcher settings.
These elements are defined dynamically so difficult to determine at advances the identifiers of the elements it contains.
Therefore, we invite you to follow the instructions of the systemwhich will tell you what to declare in this file.
You can also take inspiration from the sample to declare in advanceknown elements (Others could possibly be added tothe future hence why we don’t define them here)
news_template.fxml
Note
The contents of this file are attached to the #news_container element and do not will only be displayed if the NewsML plugin is enabled.
This element is a template that will be duplicated in proportion to Number of news.
#title_label
This element represents the title of the news.
<Label fx:id="title_label" />
It must be of the Label type or inherit it.
#day_label
This element represents the day of the writing of the news.
<Label fx:id="day_label" />
It must be of the Label type or inherit it.
#month_label
This item represents the month of news writing.
<Label fx:id="month_label" />
It must be of the Label type or inherit it.
#year_label
Note
This element is optional
This element represents the year of writing the news.
<Label fx:id="year_label" />
It must be of the Label type or inherit it.
#content_text
This element is the descriptive text of the news.
<TextArea fx:id="content_text" />
It must be of type TextArea or inherit it.
statusservermc_template.fxml
Note
The contents of this file are attached to the #statutservermc_container and will only be displayed if the pluginStatusServer™ is enabled.
#online_players_label
Warning
This item is mandatory and must be declared in the file statusservermc_template.fxml.
Cet élément affichera le nombre de connectés.
<Label fx:id="online_players_label" />
It must be of the Label type or inherit it.
#max_players_label
Note
This item is optional but must be declared in the statusservermc_template.fxml
This element will display the capacity of the server in terms of connections.
<Label fx:id="max_players_label" />
It must be of the Label type or inherit it.
#server_name_label
Note
This item is optional but must be declared in the statusservermc_template.fxml
This item will display the server name.
<Label fx:id="server_name_label" />
It must be of the Label type or inherit it.
#server_desc_text
Note
This item is optional but must be declared in the statusservermc_template.fxml
This item will display the server description.
<Label fx:id="server_desc_text" />
It must be of the Label type or inherit it.
#favicon_image
Note
This item is optional but must be declared in the statusservermc_template.fxml
This item will display the server favicon.
<ImageView fx:id="favicon_image" />
It must be of type ImageView or inherit it.
#server_statut_image
Note
This item is optional but must be declared in the statusservermc_template.fxml
This element will display the server status (on/off) as an image.Images must be named server_on and server_off and mustHave the following format: jpg, jpeg, png, gif.
<ImageView fx:id="server_statut_image" />
It must be of type ImageView or inherit it.
Translation
Introduction
Translation is an important step to be able to publish a theme onThe shop because there are customers in all corners of the world whouse our platform.
In this section, we will see how to set up the translation into different languages with semantics specific tothat in FXML.
Semantics
The % prefix is used to indicate to the compiler that there is a so-called resource bundle resolution to do in your Java project.
Here’s a code example:
<Label text="%myText" />
The compiler will fetch the value of the instance of the resource**%myText** in the associated language file.
For example, for French, translations will go into the file**locale_fr.properties**.
That is, the file name of the corresponding language must contain the prefix locale_ followed by the language code followed by the Format .properties all attached. This file must be located in the package resources bundle for successful resolution (See the JavaFX doc regarding the location of this package or the sample)
Resolution of the resource
To illustrate our remarks in the section above, the resource %myText will be replaced by the example below:
myText = Je suis prévu pour l'imprévu
It will give, theoretically:
<Label text="Je suis prévu pour l'imprévu" />