ADD::added buttons to apply tooltips to for the activities

because you can't apply tooltips to imageviews, I added the achievement images to buttons to which you can add tooltips
This commit is contained in:
Sem van der Hoeven
2019-04-08 12:55:32 +02:00
parent 2025fd02cc
commit 31def99398
3 changed files with 80 additions and 42 deletions

View File

@@ -16,10 +16,7 @@ import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.chart.PieChart;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
@@ -187,13 +184,24 @@ public class DashBoardController {
@FXML
private Label loweringTemp;
@FXML
private Button refreshHintsButton;
private Button achiev1Tip;
@FXML
private Button achiev2Tip;
@FXML
private Button achiev3Tip;
@FXML
private Button achiev4Tip;
@FXML
private Button achiev5Tip;
@FXML
private Button achiev6Tip;
/**
* Loads the the necessary things before anything else.
* @throws InterruptedException exception if interrupted
*/
public void initialize() throws InterruptedException {
hintText.setWrapText(true);
hintText.setText(hints.randomHint());
//set the dashboardPane to visible

View File

@@ -16,6 +16,7 @@
<?import javafx.scene.shape.Line?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.control.Tooltip?>
<AnchorPane prefHeight="702.0" prefWidth="1032.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="greenify.client.controller.DashBoardController">
<children>
@@ -77,7 +78,7 @@
</graphic>
</Button>
</children></AnchorPane>
<AnchorPane fx:id="activitiesPane" layoutX="214.0" prefHeight="703.0" prefWidth="820.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="214.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<AnchorPane fx:id="activitiesPane" layoutX="214.0" prefHeight="703.0" prefWidth="820.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="214.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Text fill="#002c0c" layoutX="101.0" layoutY="74.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Activity Summary" AnchorPane.leftAnchor="60.0" AnchorPane.topAnchor="40.0">
<font>
@@ -399,7 +400,7 @@
</children>
</VBox>
</children></AnchorPane>
<AnchorPane fx:id="dashboardPane" layoutX="215.0" prefHeight="703.0" prefWidth="820.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="214.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<AnchorPane fx:id="dashboardPane" layoutX="215.0" prefHeight="703.0" prefWidth="820.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="214.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Label fx:id="welcomebacktext" layoutX="69.0" layoutY="53.0" text="Welcome back user!" AnchorPane.leftAnchor="60.0" AnchorPane.topAnchor="40.0">
<font>
@@ -489,41 +490,65 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ImageView fx:id="achieve1" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/Clover.png" />
<!-- image from pngall.com - 3548 -->
</image>
</ImageView>
<ImageView fx:id="achieve2" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true" GridPane.rowIndex="1">
<image>
<Image url="@../icons/Friendship.png" />
<!-- image from pngall.com - 24498 -->
</image>
</ImageView>
<ImageView fx:id="achieve3" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true" GridPane.rowIndex="2">
<image>
<Image url="@../icons/co2dev.png" />
<!-- image from exceldryer.com -->
</image>
</ImageView>
<ImageView fx:id="achieve4" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1">
<image>
<Image url="@../icons/alternate_foods.png" />
</image>
</ImageView>
<ImageView fx:id="achieve5" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1" GridPane.rowIndex="1">
<image>
<Image url="@../icons/achiev1pic.jpg" />
<!-- image from shutterstock.com - 1038138760 -->
</image>
</ImageView>
<ImageView fx:id="achieve6" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1" GridPane.rowIndex="2">
<image>
<Image url="@../icons/solar_panels.jpeg" />
<!-- image from moregreenenergy.com -->
</image>
</ImageView>
<Button fx:id="achiev1Tip" mnemonicParsing="false" styleClass="toolTipButton">
<graphic>
<ImageView fx:id="achieve1" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/Clover.png" />
<!-- image from pngall.com - 3548 -->
</image>
</ImageView>
</graphic>
</Button>
<Button fx:id="achiev4Tip" mnemonicParsing="false" styleClass="toolTipButton" GridPane.columnIndex="1">
<graphic>
<ImageView fx:id="achieve4" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/alternate_foods.png" />
</image>
</ImageView>
</graphic>
</Button>
<Button fx:id="achiev2Tip" mnemonicParsing="false" styleClass="toolTipButton" GridPane.rowIndex="1">
<graphic>
<ImageView fx:id="achieve2" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/Friendship.png" />
<!-- image from pngall.com - 24498 -->
</image>
</ImageView>
</graphic>
</Button>
<Button fx:id="achiev3Tip" mnemonicParsing="false" styleClass="toolTipButton" GridPane.rowIndex="2">
<graphic>
<ImageView fx:id="achieve3" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/co2dev.png" />
<!-- image from exceldryer.com -->
</image>
</ImageView>
</graphic>
</Button>
<Button fx:id="achiev5Tip" mnemonicParsing="false" styleClass="toolTipButton" GridPane.columnIndex="1" GridPane.rowIndex="1">
<graphic>
<ImageView fx:id="achieve5" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/achiev1pic.jpg" />
<!-- image from shutterstock.com - 1038138760 -->
</image>
</ImageView>
</graphic>
</Button>
<Button fx:id="achiev6Tip" mnemonicParsing="false" styleClass="toolTipButton" GridPane.columnIndex="1" GridPane.rowIndex="2">
<graphic>
<ImageView fx:id="achieve6" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/solar_panels.jpeg" />
<!-- image from moregreenenergy.com -->
</image>
</ImageView>
</graphic>
</Button>
</children>
</GridPane>
</children>

View File

@@ -81,5 +81,10 @@
-fx-font-size: 14px;
}
.toolTipButton {
-fx-background-color: transparent;
-fx-padding: 0 0 0 0;
}