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

View File

@@ -16,6 +16,7 @@
<?import javafx.scene.shape.Line?> <?import javafx.scene.shape.Line?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?> <?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"> <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> <children>
@@ -77,7 +78,7 @@
</graphic> </graphic>
</Button> </Button>
</children></AnchorPane> </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> <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"> <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> <font>
@@ -399,7 +400,7 @@
</children> </children>
</VBox> </VBox>
</children></AnchorPane> </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> <children>
<Label fx:id="welcomebacktext" layoutX="69.0" layoutY="53.0" text="Welcome back user!" AnchorPane.leftAnchor="60.0" AnchorPane.topAnchor="40.0"> <Label fx:id="welcomebacktext" layoutX="69.0" layoutY="53.0" text="Welcome back user!" AnchorPane.leftAnchor="60.0" AnchorPane.topAnchor="40.0">
<font> <font>
@@ -489,41 +490,65 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<ImageView fx:id="achieve1" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true"> <Button fx:id="achiev1Tip" mnemonicParsing="false" styleClass="toolTipButton">
<image> <graphic>
<Image url="@../icons/Clover.png" /> <ImageView fx:id="achieve1" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true">
<!-- image from pngall.com - 3548 --> <image>
</image> <Image url="@../icons/Clover.png" />
</ImageView> <!-- image from pngall.com - 3548 -->
<ImageView fx:id="achieve2" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true" GridPane.rowIndex="1"> </image>
<image> </ImageView>
<Image url="@../icons/Friendship.png" /> </graphic>
<!-- image from pngall.com - 24498 --> </Button>
</image> <Button fx:id="achiev4Tip" mnemonicParsing="false" styleClass="toolTipButton" GridPane.columnIndex="1">
</ImageView> <graphic>
<ImageView fx:id="achieve3" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true" GridPane.rowIndex="2"> <ImageView fx:id="achieve4" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
<Image url="@../icons/co2dev.png" /> <Image url="@../icons/alternate_foods.png" />
<!-- image from exceldryer.com --> </image>
</image> </ImageView>
</ImageView> </graphic>
<ImageView fx:id="achieve4" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1"> </Button>
<image> <Button fx:id="achiev2Tip" mnemonicParsing="false" styleClass="toolTipButton" GridPane.rowIndex="1">
<Image url="@../icons/alternate_foods.png" /> <graphic>
</image> <ImageView fx:id="achieve2" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true">
</ImageView> <image>
<ImageView fx:id="achieve5" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1" GridPane.rowIndex="1"> <Image url="@../icons/Friendship.png" />
<image> <!-- image from pngall.com - 24498 -->
<Image url="@../icons/achiev1pic.jpg" /> </image>
<!-- image from shutterstock.com - 1038138760 --> </ImageView>
</image> </graphic>
</ImageView> </Button>
<ImageView fx:id="achieve6" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1" GridPane.rowIndex="2"> <Button fx:id="achiev3Tip" mnemonicParsing="false" styleClass="toolTipButton" GridPane.rowIndex="2">
<image> <graphic>
<Image url="@../icons/solar_panels.jpeg" /> <ImageView fx:id="achieve3" fitHeight="101.0" fitWidth="129.0" pickOnBounds="true" preserveRatio="true">
<!-- image from moregreenenergy.com --> <image>
</image> <Image url="@../icons/co2dev.png" />
</ImageView> <!-- 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> </children>
</GridPane> </GridPane>
</children> </children>

View File

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