Skip to content

Commit

Permalink
Upgrade JavaFX to ver 17
Browse files Browse the repository at this point in the history
The application uses JavaFX 11 which is reaching its EOL in September
2023. Thus it is better to upgrade JavaFX to the next LTS version which
is version 17.

However, after version 16, JavaFX now throws a warning when JavaFX
modules are loaded from the classpath. As there is currently no plan to
migrate to using Modules in AB3, let's include an additional log message
to inform the users to ignore the warning message.
  • Loading branch information
Eclipse-Dominator authored and damithc committed Aug 4, 2023
1 parent 3dbe70e commit 83b10b0
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ task coverage(type: JacocoReport) {

dependencies {
String jUnitVersion = '5.4.0'
String javaFxVersion = '11.0.2'
String javaFxVersion = '17.0.7'

implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac'
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/seedu/address/Main.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package seedu.address;

import java.util.logging.Logger;

import javafx.application.Application;
import seedu.address.commons.core.LogsCenter;

/**
* The main entry point to the application.
Expand All @@ -19,7 +22,20 @@
* to be the entry point of the application, we avoid this issue.
*/
public class Main {
private static Logger logger = LogsCenter.getLogger(Main.class);

public static void main(String[] args) {

// As per https://github.com/openjdk/jfx/blob/master/doc-files/release-notes-16.md
// JavaFX 16 (or later) runtime logs a warning at startup if JavaFX classes are loaded from
// the classpath instead of a module.
// Our application does not use Java modules yet. Even if it did, modules are ignored when
// packed into a FAT Jar file (as we do), which means this warning will persist even then.
// The warning however, can be safely ignored. Thus, the following log informs
// the user (if looking at the log output) that the said warning appearing in the log
// can be ignored.

logger.warning("The warning about Unsupported JavaFX configuration below can be ignored.");
Application.launch(MainApp.class, args);
}
}
2 changes: 1 addition & 1 deletion src/main/resources/view/CommandBox.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.StackPane?>

<StackPane styleClass="stack-pane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<StackPane styleClass="stack-pane" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<TextField fx:id="commandTextField" onAction="#handleCommandEntered" promptText="Enter command here..."/>
</StackPane>

2 changes: 1 addition & 1 deletion src/main/resources/view/HelpWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<?import javafx.scene.layout.HBox?>
<?import javafx.stage.Stage?>

<fx:root resizable="false" title="Help" type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/11" xmlns:fx="http://javafx.com/fxml/1">
<fx:root resizable="false" title="Help" type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<icons>
<Image url="@/images/help_icon.png" />
</icons>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>

<fx:root type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
<fx:root type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
title="Address App" minWidth="450" minHeight="600" onCloseRequest="#handleExit">
<icons>
<Image url="@/images/address_book_32.png" />
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/view/PersonListCard.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.VBox?>

<HBox id="cardPane" fx:id="cardPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<HBox id="cardPane" fx:id="cardPane" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<GridPane HBox.hgrow="ALWAYS">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10" prefWidth="150" />
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/view/PersonListPanel.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<?import javafx.scene.control.ListView?>
<?import javafx.scene.layout.VBox?>

<VBox xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<VBox xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<ListView fx:id="personListView" VBox.vgrow="ALWAYS" />
</VBox>
2 changes: 1 addition & 1 deletion src/main/resources/view/ResultDisplay.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.StackPane?>

<StackPane fx:id="placeHolder" styleClass="pane-with-border" xmlns="http://javafx.com/javafx/8"
<StackPane fx:id="placeHolder" styleClass="pane-with-border" xmlns="http://javafx.com/javafx/17"
xmlns:fx="http://javafx.com/fxml/1">
<TextArea fx:id="resultDisplay" editable="false" styleClass="result-display"/>
</StackPane>
2 changes: 1 addition & 1 deletion src/main/resources/view/StatusBarFooter.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>

<GridPane styleClass="status-bar" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<GridPane styleClass="status-bar" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10" />
</columnConstraints>
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/view/UiPartTest/validFileWithFxRoot.fxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<fx:root type="seedu.address.ui.TestFxmlObject" xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml">
<fx:root type="seedu.address.ui.TestFxmlObject" xmlns="http://javafx.com/javafx/17"
xmlns:fx="http://javafx.com/fxml/1">
<text>Hello World!</text>
</fx:root>

0 comments on commit 83b10b0

Please sign in to comment.