-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
168 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
app/src/main/java/cn/navclub/nes4j/app/control/IconPopup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package cn.navclub.nes4j.app.control; | ||
|
||
import cn.navclub.nes4j.app.control.skin.IconPopupSkin; | ||
import javafx.animation.FadeTransition; | ||
import javafx.beans.property.ObjectProperty; | ||
import javafx.beans.property.SimpleObjectProperty; | ||
import javafx.scene.control.PopupControl; | ||
import javafx.scene.control.Skin; | ||
import javafx.scene.image.Image; | ||
import javafx.stage.Screen; | ||
import javafx.util.Duration; | ||
|
||
/** | ||
* A icon popup implement. | ||
* | ||
* @author <a href="https://github.com/GZYangKui">GZYangKui</a> | ||
*/ | ||
public class IconPopup extends PopupControl { | ||
private final FadeTransition transition; | ||
private final ObjectProperty<Image> image; | ||
|
||
public IconPopup() { | ||
this.setAutoFix(true); | ||
this.transition = new FadeTransition(); | ||
this.transition.setToValue(0); | ||
this.transition.setFromValue(1.0); | ||
this.transition.setOnFinished(event -> this.hide()); | ||
this.transition.setDuration(Duration.millis(1000)); | ||
this.image = new SimpleObjectProperty<>(this, "image", null); | ||
|
||
this.setOnShown(event -> { | ||
this.transition.stop(); | ||
this.transition.setNode(this.getSkin().getNode()); | ||
this.transition.setDelay(Duration.millis(500)); | ||
this.transition.play(); | ||
this.calculateXY(); | ||
}); | ||
} | ||
|
||
public IconPopup(Image image) { | ||
this(); | ||
this.setImage(image); | ||
} | ||
|
||
@Override | ||
protected Skin<?> createDefaultSkin() { | ||
return new IconPopupSkin(this); | ||
} | ||
|
||
public Image getImage() { | ||
return image.get(); | ||
} | ||
|
||
public ObjectProperty<Image> imageProperty() { | ||
return image; | ||
} | ||
|
||
public void setImage(Image image) { | ||
this.image.set(image); | ||
} | ||
|
||
private void calculateXY() { | ||
var screen = Screen.getPrimary(); | ||
var rect = screen.getVisualBounds(); | ||
|
||
var x = (rect.getWidth() - this.getWidth()) / 2; | ||
var y = (rect.getHeight() - this.getHeight()) - 10; | ||
|
||
this.setX(x); | ||
this.setY(y); | ||
} | ||
} |
104 changes: 0 additions & 104 deletions
104
app/src/main/java/cn/navclub/nes4j/app/control/StatusIndicator.java
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
app/src/main/java/cn/navclub/nes4j/app/control/skin/IconPopupSkin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package cn.navclub.nes4j.app.control.skin; | ||
|
||
import cn.navclub.nes4j.app.assets.FXResource; | ||
import cn.navclub.nes4j.app.control.IconPopup; | ||
import javafx.scene.Node; | ||
import javafx.scene.control.Skin; | ||
import javafx.scene.image.ImageView; | ||
import javafx.scene.layout.VBox; | ||
|
||
|
||
public class IconPopupSkin implements Skin<IconPopup> { | ||
private VBox node; | ||
@SuppressWarnings("all") | ||
private final ImageView icon; | ||
private final IconPopup popup; | ||
|
||
public IconPopupSkin(IconPopup popup) { | ||
this.popup = popup; | ||
this.node = new VBox(); | ||
this.icon = new ImageView(); | ||
|
||
this.icon.imageProperty().bind(popup.imageProperty()); | ||
|
||
this.node.getChildren().add(this.icon); | ||
this.node.getStyleClass().add("text-popup"); | ||
this.node.getStylesheets().add(FXResource.loadStyleSheet("TextPopup.css")); | ||
} | ||
|
||
@Override | ||
public IconPopup getSkinnable() { | ||
return this.popup; | ||
} | ||
|
||
@Override | ||
public Node getNode() { | ||
return node; | ||
} | ||
|
||
@Override | ||
public void dispose() { | ||
this.node = null; | ||
this.icon.imageProperty().unbind(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
app/src/main/resources/cn/navclub/nes4j/app/assets/css/DException.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@import "common.css"; | ||
@import "Common.css"; | ||
|
||
.text-area { | ||
-fx-padding: 0; | ||
|
2 changes: 1 addition & 1 deletion
2
app/src/main/resources/cn/navclub/nes4j/app/assets/css/DHandle.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@import "common.css"; | ||
@import "Common.css"; | ||
|
||
.box, .content { | ||
-fx-spacing: 2em; | ||
|
2 changes: 1 addition & 1 deletion
2
app/src/main/resources/cn/navclub/nes4j/app/assets/css/DNesHeaderStyle.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@import "common.css"; | ||
@import "Common.css"; | ||
|
||
GridPane { | ||
-fx-hgap: 1em; | ||
|
2 changes: 1 addition & 1 deletion
2
app/src/main/resources/cn/navclub/nes4j/app/assets/css/DebuggerStyle.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@import "common.css"; | ||
@import "Common.css"; | ||
|
||
GridPane { | ||
-fx-vgap: 1em; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
app/src/main/resources/cn/navclub/nes4j/app/assets/css/Nes4j.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@import "common.css"; | ||
@import "Common.css"; | ||
|
||
.left-box, .right-box { | ||
-fx-spacing: .5em; | ||
|
2 changes: 1 addition & 1 deletion
2
app/src/main/resources/cn/navclub/nes4j/app/assets/css/SystemPalette.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@import "common.css"; | ||
@import "Common.css"; | ||
|
||
VBox { | ||
-fx-spacing: 1em; | ||
|
9 changes: 9 additions & 0 deletions
9
app/src/main/resources/cn/navclub/nes4j/app/assets/css/TextPopup.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@import "Common.css"; | ||
|
||
.text-popup { | ||
-fx-padding: 2em 3em; | ||
-fx-alignment: CENTER; | ||
-fx-border-radius: .5em; | ||
-fx-background-radius: .5em; | ||
-fx-background-color: rgba(0, 0, 0, .8); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.