Skip to content

Commit 6433615

Browse files
committed
New button style
1 parent fec2655 commit 6433615

File tree

2 files changed

+76
-17
lines changed

2 files changed

+76
-17
lines changed

ui/src/main/java/edu/wpi/grip/ui/AboutDialogController.java

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package edu.wpi.grip.ui;
22

3-
import javafx.event.ActionEvent;
43
import javafx.fxml.FXML;
4+
import javafx.scene.input.MouseEvent;
5+
import javafx.scene.paint.Color;
6+
import javafx.scene.shape.Rectangle;
57
import javafx.scene.text.Text;
68

79
import javax.inject.Inject;
@@ -15,18 +17,61 @@ public class AboutDialogController {
1517
private Text versionNumberText;
1618

1719
@FXML
18-
void githubButtonAction(ActionEvent event) {
19-
main.getHostServices().showDocument("https://github.com/WPIRoboticsProjects/GRIP");
20+
private Rectangle githubRectangle;
21+
22+
@FXML
23+
private Text githubText;
24+
25+
@FXML
26+
private Rectangle documentationRectangle;
27+
28+
@FXML
29+
private Text documentationText;
30+
31+
private static final Color CLEAR_COLOR = new Color(0.0, 0.0, 0.0, 0.0);
32+
33+
@FXML
34+
void mouseEnteredDocumentationButton(MouseEvent event) {
35+
documentationRectangle.setFill(Color.GRAY);
36+
documentationText.setFill(Color.WHITE);
37+
}
38+
39+
@FXML
40+
void mouseEnteredGithubButton(MouseEvent event) {
41+
githubRectangle.setFill(Color.GRAY);
42+
githubText.setFill(Color.WHITE);
43+
}
44+
45+
@FXML
46+
void mouseExitedDocumentationButton(MouseEvent event) {
47+
documentationRectangle.setFill(CLEAR_COLOR);
48+
documentationText.setFill(Color.BLACK);
49+
}
50+
51+
@FXML
52+
void mouseExitedGithubButton(MouseEvent event) {
53+
githubRectangle.setFill(CLEAR_COLOR);
54+
githubText.setFill(Color.BLACK);
2055
}
2156

2257
@FXML
23-
void screenstepsButtonAction(ActionEvent event) {
58+
void mousePressedDocumentationButton(MouseEvent event) {
2459
main.getHostServices().showDocument("http://wpilib.screenstepslive.com/s/4485/m/50711");
2560
}
2661

62+
@FXML
63+
void mousePressedGithubButton(MouseEvent event) {
64+
main.getHostServices().showDocument("https://github.com/WPIRoboticsProjects/GRIP");
65+
}
66+
2767
@FXML
2868
void initialize() {
2969
assert versionNumberText != null : "fx:id=\"versionNumberText\" was not injected: check your FXML file 'AboutDialog.fxml'.";
70+
assert githubRectangle != null : "fx:id=\"githubRectangle\" was not injected: check your FXML file 'AboutDialog.fxml'.";
71+
assert githubText != null : "fx:id=\"githubText\" was not injected: check your FXML file 'AboutDialog.fxml'.";
72+
assert documentationRectangle != null : "fx:id=\"documentationRectangle\" was not injected: check your FXML file 'AboutDialog.fxml'.";
73+
assert documentationText != null : "fx:id=\"documentationText\" was not injected: check your FXML file 'AboutDialog.fxml'.";
74+
3075

3176
versionNumberText.setText("Version " + edu.wpi.grip.core.Main.class.getPackage().getImplementationVersion());
3277
}

ui/src/main/resources/edu/wpi/grip/ui/AboutDialog.fxml

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<?import javafx.geometry.Insets?>
4-
<?import javafx.scene.control.Button?>
54
<?import javafx.scene.image.Image?>
65
<?import javafx.scene.image.ImageView?>
76
<?import javafx.scene.layout.HBox?>
87
<?import javafx.scene.layout.Pane?>
8+
<?import javafx.scene.layout.StackPane?>
99
<?import javafx.scene.layout.VBox?>
10+
<?import javafx.scene.shape.Rectangle?>
1011
<?import javafx.scene.text.Font?>
1112
<?import javafx.scene.text.Text?>
1213

@@ -37,18 +38,31 @@
3738
<Pane VBox.vgrow="ALWAYS" />
3839
<HBox>
3940
<children>
40-
<Button mnemonicParsing="false" onAction="#githubButtonAction" text="Github...">
41-
<font>
42-
<Font size="14.0" />
43-
</font>
44-
</Button>
45-
<Pane HBox.hgrow="ALWAYS" />
46-
<Button mnemonicParsing="false" onAction="#screenstepsButtonAction" text="ScreenSteps...">
47-
<font>
48-
<Font name="Roboto Regular" size="14.0" />
49-
</font>
50-
</Button>
51-
<Pane HBox.hgrow="ALWAYS" />
41+
<StackPane onMouseEntered="#mouseEnteredGithubButton" onMouseExited="#mouseExitedGithubButton" onMousePressed="#mousePressedGithubButton">
42+
<children>
43+
<Rectangle fx:id="githubRectangle" arcHeight="20.0" arcWidth="20.0" fill="#ffffff00" height="20.0" stroke="#ffffff00" strokeType="INSIDE" strokeWidth="0.0" width="65.0" />
44+
<Text fx:id="githubText" strokeType="OUTSIDE" strokeWidth="0.0" text="➔ Github">
45+
<font>
46+
<Font name="Roboto Regular" size="14.0" />
47+
</font>
48+
</Text>
49+
</children>
50+
</StackPane>
51+
</children>
52+
</HBox>
53+
<Pane VBox.vgrow="ALWAYS" />
54+
<HBox>
55+
<children>
56+
<StackPane onMouseEntered="#mouseEnteredDocumentationButton" onMouseExited="#mouseExitedDocumentationButton" onMousePressed="#mousePressedDocumentationButton">
57+
<children>
58+
<Rectangle fx:id="documentationRectangle" arcHeight="20.0" arcWidth="20.0" fill="#ffffff00" height="20.0" stroke="#ffffff00" strokeType="INSIDE" strokeWidth="0.0" width="205.0" />
59+
<Text fx:id="documentationText" strokeType="OUTSIDE" strokeWidth="0.0" text="➔ ScreenSteps Documentation">
60+
<font>
61+
<Font name="Roboto Regular" size="14.0" />
62+
</font>
63+
</Text>
64+
</children>
65+
</StackPane>
5266
</children>
5367
</HBox>
5468
</children>

0 commit comments

Comments
 (0)