Skip to content
Snippets Groups Projects
Commit 1f6e525b authored by Runar Halvorsen Indahl's avatar Runar Halvorsen Indahl
Browse files

feat(main...HomeController): Added functionality for opening an url by buttons

parent bdc04f9c
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,11 @@ import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
/**
* Home Controller
......@@ -50,8 +55,9 @@ public class HomeController {
* @param event - ActionEvent that is derived from the page
* and contains information about an event */
@FXML
void getHelp(ActionEvent event) {
void getHelp(ActionEvent event) throws URISyntaxException, IOException {
Desktop.getDesktop().browse(new URI(
"https://funvizeo.com/meme/hulk-help-you-now-you-help-hulk-meme-9a0f252e027036e9"));
}
/**
......@@ -61,8 +67,9 @@ public class HomeController {
* and contains information about an event
*/
@FXML
void getRules(ActionEvent event) {
void getRules(ActionEvent event) throws URISyntaxException, IOException {
Desktop.getDesktop().browse(new URI(
"https://floorball.sport/rules-and-regulations/rules-of-the-game/"));
}
......
......@@ -2,6 +2,7 @@ module edu.ntnu.idatt1002.k1g4 {
requires javafx.controls;
requires javafx.fxml;
requires javafx.graphics;
requires java.desktop;
opens edu.ntnu.idatt1002.k1g4.client to javafx.fxml;
opens edu.ntnu.idatt1002.k1g4.client.controllers to javafx.fxml;
......
......@@ -4,6 +4,8 @@
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.effect.Blend?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
......@@ -60,21 +62,35 @@
<bottom>
<HBox prefHeight="100.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<children>
<Button fx:id="rules" mnemonicParsing="false" onAction="#getRules" prefHeight="50.0" prefWidth="112.0" text="Rules">
<Button fx:id="rules" contentDisplay="RIGHT" mnemonicParsing="false" onAction="#getRules" prefHeight="50.0" prefWidth="112.0" text="Rules">
<opaqueInsets>
<Insets left="300.0" right="30.0" />
</opaqueInsets>
<effect>
<Blend opacity="0.15" />
</effect>
<graphic>
<ImageView fitHeight="10.0" fitWidth="10.0">
<image>
<Image url="@icons/link.png" />
</image>
</ImageView>
</graphic>
</Button>
<Button fx:id="help" mnemonicParsing="false" onAction="#getHelp" prefHeight="51.0" prefWidth="106.0" text="Help">
<Button fx:id="help" contentDisplay="RIGHT" mnemonicParsing="false" onAction="#getHelp" prefHeight="51.0" prefWidth="106.0" text="Help">
<opaqueInsets>
<Insets left="50.0" right="20.0" />
</opaqueInsets>
<HBox.margin>
<Insets left="30.0" />
</HBox.margin>
<graphic>
<ImageView fitHeight="10.0" fitWidth="10.0">
<image>
<Image url="@icons/link.png" />
</image>
</ImageView>
</graphic>
</Button>
</children>
<padding>
......
src/main/resources/icons/link.png

12 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment