add a close button
This commit is contained in:
parent
525a25769b
commit
74d0bb5fe7
2 changed files with 19 additions and 1 deletions
|
@ -1,15 +1,18 @@
|
|||
package dev.nuculabs.imagetagger.ui.pages
|
||||
|
||||
import javafx.application.Platform
|
||||
import javafx.fxml.FXML
|
||||
import javafx.fxml.FXMLLoader
|
||||
import javafx.scene.Parent
|
||||
import javafx.scene.Scene
|
||||
import javafx.scene.control.Button
|
||||
import javafx.stage.Stage
|
||||
import java.awt.Desktop
|
||||
import java.net.URL
|
||||
|
||||
|
||||
class AboutPage {
|
||||
lateinit var closeButton: Button
|
||||
|
||||
@FXML
|
||||
fun openBlog() {
|
||||
|
@ -21,6 +24,15 @@ class AboutPage {
|
|||
Desktop.getDesktop().browse(URL("https://github.com/dnutiu/ImageTagger").toURI());
|
||||
}
|
||||
|
||||
@FXML
|
||||
fun closePage() {
|
||||
Platform.runLater {
|
||||
// Get a reference to the stage
|
||||
val stage = closeButton.scene.window as Stage
|
||||
stage.hide()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun show() {
|
||||
val fxmlLoader = FXMLLoader(AboutPage::class.java.getResource("about-page.fxml"))
|
||||
|
|
|
@ -42,6 +42,12 @@
|
|||
<FontIcon iconLiteral="fab-github" iconSize="16"/>
|
||||
</graphic>
|
||||
</Hyperlink>
|
||||
|
||||
<HBox alignment="CENTER_RIGHT" prefWidth="Infinity">
|
||||
<Button fx:id="closeButton" text="Close" onAction="#closePage">
|
||||
<graphic>
|
||||
<FontIcon iconLiteral="fas-window-close" iconSize="16"/>
|
||||
</graphic>
|
||||
</Button>
|
||||
</HBox>
|
||||
</VBox>
|
||||
</AnchorPane>
|
||||
|
|
Loading…
Reference in a new issue