-
Notifications
You must be signed in to change notification settings - Fork 12
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
28 changed files
with
157 additions
and
43 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package jrm.fx.ui; | ||
|
||
import javafx.beans.NamedArg; | ||
import javafx.scene.Parent; | ||
import javafx.scene.Scene; | ||
import javafx.scene.SceneAntialiasing; | ||
import javafx.scene.paint.Paint; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
public class JRMScene extends Scene | ||
{ | ||
public enum StyleSheet | ||
{ | ||
SYSTEM(null), XS("XS.css"), S("S.css"), M("M.css"), L("L.css"), XL("XL.css"); | ||
|
||
@Getter | ||
private String fileName; | ||
|
||
private StyleSheet(String fileName) | ||
{ | ||
this.fileName = fileName; | ||
} | ||
} | ||
|
||
@Getter @Setter private static StyleSheet sheet = StyleSheet.XL; | ||
|
||
private String[] orgSheets; | ||
|
||
public JRMScene(@NamedArg("root") Parent root, @NamedArg(value="width", defaultValue="-1") double width, @NamedArg(value="height", defaultValue="-1") double height, @NamedArg("depthBuffer") boolean depthBuffer, @NamedArg(value="antiAliasing", defaultValue="DISABLED") SceneAntialiasing antiAliasing) | ||
{ | ||
super(root, width, height, depthBuffer, antiAliasing); | ||
initSheets(); | ||
} | ||
|
||
public JRMScene(@NamedArg("root") Parent root, @NamedArg(value="width", defaultValue="-1") double width, @NamedArg(value="height", defaultValue="-1") double height, @NamedArg("depthBuffer") boolean depthBuffer) | ||
{ | ||
super(root, width, height, depthBuffer); | ||
initSheets(); | ||
} | ||
|
||
public JRMScene(@NamedArg("root") Parent root, @NamedArg(value="width", defaultValue="-1") double width, @NamedArg(value="height", defaultValue="-1") double height, @NamedArg(value="fill", defaultValue="WHITE") Paint fill) | ||
{ | ||
super(root, width, height, fill); | ||
initSheets(); | ||
} | ||
|
||
public JRMScene(@NamedArg("root") Parent root, @NamedArg(value="width", defaultValue="-1") double width, @NamedArg(value="height", defaultValue="-1") double height) | ||
{ | ||
super(root, width, height); | ||
initSheets(); | ||
} | ||
|
||
public JRMScene(@NamedArg("root") Parent root, Paint fill) | ||
{ | ||
super(root, fill); | ||
initSheets(); | ||
} | ||
|
||
public JRMScene(@NamedArg("root") Parent root) | ||
{ | ||
super(root); | ||
initSheets(); | ||
} | ||
|
||
private void initSheets() | ||
{ | ||
final var styleSheets = getStylesheets(); | ||
orgSheets = styleSheets.toArray(String[]::new); | ||
applySheet(sheet); | ||
} | ||
|
||
public void applySheet(StyleSheet ss) | ||
{ | ||
getStylesheets().clear(); | ||
getStylesheets().addAll(orgSheets); | ||
setSheet(ss); | ||
applySheet(this); | ||
} | ||
|
||
public static void applySheet(Scene scene) | ||
{ | ||
if(sheet.fileName!=null) | ||
{ | ||
final var url = Scene.class.getResource("/jrm/fx/ui/css/%s".formatted(sheet.fileName)).toExternalForm(); | ||
scene.getStylesheets().add(url); | ||
} | ||
} | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.root { -fx-font-size: 17pt; } | ||
.table-view { -fx-font-size: 0.8em; } | ||
.tree-view { -fx-font-size: 0.8em; } | ||
.list-view { -fx-font-size: 0.8em; } | ||
.choice-box { -fx-font-size: 0.8em; } | ||
.context-menu { -fx-font-size: 14pt; } | ||
.titled-pane { -fx-font-size: 0.8em; } |
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,7 @@ | ||
.root { -fx-font-size: 14pt; } | ||
.table-view { -fx-font-size: 0.8em; } | ||
.tree-view { -fx-font-size: 0.8em; } | ||
.list-view { -fx-font-size: 0.8em; } | ||
.choice-box { -fx-font-size: 0.8em; } | ||
.context-menu { -fx-font-size: 12pt; } | ||
.titled-pane { -fx-font-size: 0.8em; } |
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,7 @@ | ||
.root { -fx-font-size: 11pt; } | ||
.table-view { -fx-font-size: 0.8em; } | ||
.tree-view { -fx-font-size: 0.8em; } | ||
.list-view { -fx-font-size: 0.8em; } | ||
.choice-box { -fx-font-size: 0.8em; } | ||
.context-menu { -fx-font-size: 10pt; } | ||
.titled-pane { -fx-font-size: 0.8em; } |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.root { -fx-font-size: 8pt; } | ||
.table-view { -fx-font-size: 0.8em; } | ||
.tree-view { -fx-font-size: 0.8em; } | ||
.list-view { -fx-font-size: 0.8em; } | ||
.choice-box { -fx-font-size: 0.8em; } | ||
.context-menu { -fx-font-size: 7pt; } | ||
.titled-pane { -fx-font-size: 0.8em; } |
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
Oops, something went wrong.