Java 类javafx.scene.layout.CornerRadii 实例源码
项目:Hive_Game
文件:GameScreenController.java
public void initButtonByInventory() {
inventoryGroup.getToggles().remove(0, inventoryGroup.getToggles().size());
if (core.getCurrentPlayer() == 0) {
inventoryPlayer1.setBorder(new Border(new BorderStroke(Color.GREEN, BorderStrokeStyle.SOLID, new CornerRadii(10), new BorderWidths(3))));
inventoryPlayer2.setBorder(Border.EMPTY);
inventoryPlayer1.setStyle("-fx-effect: none");
inventoryPlayer2.setStyle("-fx-effect: innershadow(one-pass-box, lightblue, 100, 0.1, 1, 1);");
namePlayer1.setText(core.getPlayers()[0].getName() + " à vous de jouer !");
namePlayer2.setText(core.getPlayers()[1].getName() + " attend !");
} else {
inventoryPlayer1.setBorder(Border.EMPTY);
inventoryPlayer2.setStyle("-fx-effect: none");
inventoryPlayer1.setStyle("-fx-effect: innershadow(one-pass-box, lightgrey, 100, 0.1, 1, 1);");
inventoryPlayer2.setBorder(new Border(new BorderStroke(Color.GREEN, BorderStrokeStyle.SOLID, new CornerRadii(10), new BorderWidths(3))));
namePlayer1.setText(core.getPlayers()[0].getName() + " attend !");
namePlayer2.setText(core.getPlayers()[1].getName() + " à vous de jouer !");
}
initPlayer1Button();
initPlayer2Button();
}
项目:medusademo
文件:TemplateClockSkin.java
private void initGraphics() {
// Set initial size
if (Double.compare(getSkinnable().getPrefWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getPrefHeight(), 0.0) <= 0 ||
Double.compare(getSkinnable().getWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getHeight(), 0.0) <= 0) {
if (getSkinnable().getPrefWidth() > 0 && getSkinnable().getPrefHeight() > 0) {
getSkinnable().setPrefSize(getSkinnable().getPrefWidth(), getSkinnable().getPrefHeight());
} else {
getSkinnable().setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
pane = new Pane();
pane.setBorder(new Border(new BorderStroke(getSkinnable().getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(getSkinnable().getBorderWidth()))));
pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
getChildren().setAll(pane);
}
项目:Hive_Game
文件:NewGameScreenController.java
public void majColorButton(){
switch(state){
case Consts.WHITE:
colorPlayer1.setBackground(new Background(new BackgroundFill(new ImagePattern(new Image(getClass().getClassLoader().getResource("main/resources/img/misc/whitestart.png").toString())), CornerRadii.EMPTY, Insets.EMPTY)));
colorPlayer2.setBackground(new Background(new BackgroundFill(new ImagePattern(new Image(getClass().getClassLoader().getResource("main/resources/img/misc/blackstart.png").toString())), CornerRadii.EMPTY, Insets.EMPTY)));
break;
case Consts.BLACK:
colorPlayer2.setBackground(new Background(new BackgroundFill(new ImagePattern(new Image(getClass().getClassLoader().getResource("main/resources/img/misc/whitestart.png").toString())), CornerRadii.EMPTY, Insets.EMPTY)));
colorPlayer1.setBackground(new Background(new BackgroundFill(new ImagePattern(new Image(getClass().getClassLoader().getResource("main/resources/img/misc/blackstart.png").toString())), CornerRadii.EMPTY, Insets.EMPTY)));
break;
case Consts.RANDOM:
colorPlayer1.setBackground(new Background(new BackgroundFill(new ImagePattern(new Image(getClass().getClassLoader().getResource("main/resources/img/misc/rngstart.png").toString())), CornerRadii.EMPTY, Insets.EMPTY)));
colorPlayer2.setBackground(new Background(new BackgroundFill(new ImagePattern(new Image(getClass().getClassLoader().getResource("main/resources/img/misc/rngstart.png").toString())), CornerRadii.EMPTY, Insets.EMPTY)));
break;
default:
break;
}
}
项目:Hive_Game
文件:NetworkScreenController.java
@FXML
public void handleLaunchGameClick() {
String player = "Anonyme";
Core core = new Core(-1, -1);
String host = choiceClient.isSelected() ? hostName.getText() : null;
int mode = choiceHost.isSelected() ? (state == Consts.WHITE ? Consts.PVEX : Consts.EXVP) : -1;
if(!playerName.getText().equals(""))
player = playerName.getText();
int error = core.connect(host, mode, player);
if (error == 0) {
core.playNextTurn();
main.showGameScreen(core,false);
} else if (choiceClient.isSelected()) {
hostName.setBackground(
new Background(new BackgroundFill(Color.ORANGERED, new CornerRadii(2), new Insets(2))));
hostName.clear();
hostName.setText(error==1?"Host inconnnu":"Erreur de connexion");
} else {
playerName.setBackground(
new Background(new BackgroundFill(Color.ORANGERED, new CornerRadii(2), new Insets(2))));
playerName.clear();
playerName.setText("Erreur de connexion");
}
// hostName.setBorder(new Border(new BorderStroke(Color.RED,
// BorderStrokeStyle.SOLID, new CornerRadii(10), BorderWidths.FULL)));
}
项目:Hive_Game
文件:NetworkScreenController.java
public void majColorButton() {
switch (state) {
case Consts.WHITE:
colorHost.setBackground(new Background(new BackgroundFill(
new ImagePattern(new Image(getClass().getClassLoader()
.getResource("main/resources/img/misc/whitestart.png").toString())),
CornerRadii.EMPTY, Insets.EMPTY)));
break;
case Consts.BLACK:
colorHost.setBackground(new Background(new BackgroundFill(
new ImagePattern(new Image(getClass().getClassLoader()
.getResource("main/resources/img/misc/blackstart.png").toString())),
CornerRadii.EMPTY, Insets.EMPTY)));
break;
case Consts.RANDOM:
colorHost.setBackground(new Background(new BackgroundFill(
new ImagePattern(new Image(getClass().getClassLoader()
.getResource("main/resources/img/misc/rngstart.png").toString())),
CornerRadii.EMPTY, Insets.EMPTY)));
break;
default:
break;
}
}
项目:smoothcharts
文件:SmoothedChart.java
public void setLegendSymbolFill(final Series<X, Y> SERIES, final Paint LEGEND_SYMBOL_FILL) {
if (getData().isEmpty()) { return; }
if (!getData().contains(SERIES)) { return; }
int seriesIndex = getData().indexOf(SERIES);
if (seriesIndex == -1) { return; }
Legend legend = (Legend) getLegend();
if (null == legend) { return; }
LegendItem item = legend.getItems().get(seriesIndex);
if (null == item) { return; }
Region symbol = (Region) item.getSymbol();
if (null == symbol) { return; }
symbol.setBackground(new Background(new BackgroundFill(LEGEND_SYMBOL_FILL, new CornerRadii(6), Insets.EMPTY)));
}
项目:smoothcharts
文件:Demo.java
@Override public void start(Stage stage) {
GridPane pane = new GridPane();
pane.setBackground(new Background(new BackgroundFill(Color.DARKGRAY, CornerRadii.EMPTY, Insets.EMPTY)));
pane.setPadding(new Insets(10));
pane.setHgap(10);
pane.setVgap(10);
pane.add(lineChartNotSmoothed, 0, 0);
pane.add(lineChartSmoothed, 1, 0);
pane.add(areaChartNotSmoothed, 0, 1);
pane.add(areaChartSmoothed, 1, 1);
pane.add(tweakedChart, 0, 2);
pane.add(tweaked2Chart, 1, 2);
Scene scene = new Scene(pane);
stage.setTitle("Smooth Charts");
stage.setScene(scene);
stage.show();
}
项目:charts
文件:SunburstChart.java
private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight());
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
segmentPane = new Pane();
chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
chartCanvas.setMouseTransparent(true);
chartCtx = chartCanvas.getGraphicsContext2D();
pane = new Pane(segmentPane, chartCanvas);
pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));
getChildren().setAll(pane);
prepareData();
}
项目:CapsLock
文件:CharPanelGenerator.java
/**
* Generates a panel image form char.
* <p>First, this function converts ch to upper case if ch is lower case.</p>
* <p>Then, this generates javafx's image from ch.And return it.</p>
* You can fix the resolution of image through {@link capslock.CharPanelGenerator#PANEL_IMAGE_SIZE}
* and {@link capslock.CharPanelGenerator#FONT_SIZE}.
* @param ch パネルの生成に使う1文字.
* @param color 背景色.
* @return 生成されたパネル.
*/
static final Image generate(char ch, Color color){
final Label label = new Label(Character.toString(Character.toUpperCase(ch)));
label.setMinSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
label.setMaxSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
label.setPrefSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
label.setFont(Font.font(FONT_SIZE));
label.setAlignment(Pos.CENTER);
label.setTextFill(Color.WHITE);
label.setBackground(new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)));
final Scene scene = new Scene(new Group(label));
final WritableImage img = new WritableImage(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
scene.snapshot(img);
return img ;
}
项目:hol1634
文件:Region.java
private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 ||
Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight());
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
getStyleClass().add("my-region");
pane = new Pane();
pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));
getChildren().setAll(pane);
}
项目:hol1634
文件:Skin.java
private void initGraphics() {
if (Double.compare(getSkinnable().getPrefWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getPrefHeight(), 0.0) <= 0 ||
Double.compare(getSkinnable().getWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getHeight(), 0.0) <= 0) {
if (getSkinnable().getPrefWidth() > 0 && getSkinnable().getPrefHeight() > 0) {
getSkinnable().setPrefSize(getSkinnable().getPrefWidth(), getSkinnable().getPrefHeight());
} else {
getSkinnable().setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
node = new Region();
node.getStyleClass().setAll("node");
pane = new Pane(node);
pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));
getChildren().setAll(pane);
}
项目:Medusa
文件:ChargeSkin.java
private void initGraphics() {
// Set initial size
if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
} else {
gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
for (int i = 0 ; i < 12 ; i++) {
Region bar = new Region();
bar.setPrefSize(20, 20 + (i * 4));
bars[i] = bar;
}
pane = new HBox(bars);
pane.setSpacing(PREFERRED_WIDTH * 0.01960784);
pane.setAlignment(Pos.BOTTOM_CENTER);
pane.setFillHeight(false);
pane.setBackground(new Background(new BackgroundFill(backgroundPaint, new CornerRadii(1024), Insets.EMPTY)));
pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(borderWidth))));
getChildren().setAll(pane);
}
项目:tilesfx
文件:BarChartItem.java
private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 ||
Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight());
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
nameText = new Text(getName());
nameText.setTextOrigin(VPos.TOP);
valueText = new Text(String.format(locale, formatString, getValue()));
valueText.setTextOrigin(VPos.TOP);
barBackground = new Rectangle();
bar = new Rectangle();
pane = new Pane(nameText, valueText, barBackground, bar);
pane.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
getChildren().setAll(pane);
}
项目:Medusa
文件:LevelSkin.java
@Override protected void redraw() {
locale = gauge.getLocale();
formatString = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f%%").toString();
// Background stroke and fill
pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * width))));
pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
fluidBody.setFill(gauge.getBarColor());
fluidTop.setFill(gauge.getBarColor().darker());
valueText.setFill(gauge.getValueColor());
titleText.setFill(gauge.getTitleColor());
resizeText();
setBar(gauge.getCurrentValue());
}
项目:hol1634
文件:Region.java
private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 ||
Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight());
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
getStyleClass().add("my-region");
pane = new Pane();
pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));
getChildren().setAll(pane);
}
项目:particlesfx
文件:CanvasBubbles.java
@Override public void start(Stage stage) throws Exception {
StackPane pane = new StackPane(canvas);
pane.setBackground(new Background(new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY)));
Scene scene = new Scene(pane);
stage.setTitle("Canvas Bubbles");
stage.setScene(scene);
stage.show();
// Calculate number of nodes
calcNoOfNodes(pane);
System.out.println(noOfNodes + " Nodes in SceneGraph");
System.out.println(NO_OF_PARTICLES + " Particles");
timer.start();
}
项目:particlesfx
文件:NodeBubbles.java
@Override public void start(Stage stage) {
Pane pane = new Pane(particles);
pane.setPrefSize(WIDTH, HEIGHT);
pane.setBackground(new Background(new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY)));
Scene scene = new Scene(pane);
scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
stage.setTitle("NodeBubbles");
stage.setScene(scene);
stage.show();
// Calculate number of nodes
calcNoOfNodes(pane);
System.out.println(noOfNodes + " Nodes in SceneGraph");
System.out.println(NO_OF_PARTICLES + " Particles");
timer.start();
}
项目:Jeu-des-6-couleurs
文件:Home.java
@Override
public void start(Stage stage) throws Exception {
try {
// Chargement de l'interface FXML
GridPane root = FXMLLoader.load(getClass().getResource("Home.fxml"));
root.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
// Création de la scène
Scene scene = new Scene(root);
stage.setTitle("Jeu des 6 couleurs");
stage.setScene(scene);
stage.show();
mainStage = stage;
} catch(Exception e) {
e.printStackTrace();
}
}
项目:Medusa
文件:TinySkin.java
@Override protected void redraw() {
pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
locale = gauge.getLocale();
formatString = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f").toString();
colorGradientEnabled = gauge.isGradientBarEnabled();
noOfGradientStops = gauge.getGradientBarStops().size();
barBackground.setStroke(gauge.getBarBackgroundColor());
// Areas, Sections and Tick Marks
sectionCanvas.setCache(false);
sectionCtx.clearRect(0, 0, size, size);
if (gauge.isGradientBarEnabled() && gauge.getGradientLookup() != null) {
drawGradientBar();
if (gauge.getMajorTickMarksVisible()) drawTickMarks();
} else if (gauge.getSectionsVisible()) {
drawSections();
if (gauge.getMajorTickMarksVisible()) drawTickMarks();
}
sectionCanvas.setCache(true);
sectionCanvas.setCacheHint(CacheHint.QUALITY);
needle.setFill(gauge.getNeedleColor());
}
项目:hol1634
文件:MyRegion.java
private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 ||
Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight());
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
getStyleClass().add("my-region");
pane = new Pane();
pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));
getChildren().setAll(pane);
}
项目:Retrospector
文件:Retrospector.java
@Override
public void init() {
ImageView splash = new ImageView(new Image(
SPLASH_IMAGE,
SPLASH_WIDTH,
SPLASH_HEIGHT,
true,
true
));
loadProgress = new ProgressBar(0);
loadProgress.setPrefWidth(SPLASH_WIDTH);
progressText = new Label("Initializing . . .");
progressText.setBackground(new Background(new BackgroundFill(Color.GHOSTWHITE,new CornerRadii(5),new Insets(0))));
splashLayout = new VBox();
splashLayout.getChildren().addAll(splash, loadProgress, progressText);
progressText.setAlignment(Pos.CENTER);
splashLayout.setBackground(Background.EMPTY);
}
项目:medusademo
文件:MultiGaugeDemo.java
@Override public void start(Stage stage) {
StackPane pane = new StackPane(gauge);
pane.setPadding(new Insets(20));
pane.setBackground(new Background(new BackgroundFill(Gauge.DARK_COLOR, CornerRadii.EMPTY, Insets.EMPTY)));
Scene scene = new Scene(pane);
stage.setTitle("Medusa MultiGauge");
stage.setScene(scene);
stage.show();
timer.start();
// Calculate number of nodes
calcNoOfNodes(pane);
System.out.println(noOfNodes + " Nodes in SceneGraph");
}
项目:medusademo
文件:TemplateGaugeSkin.java
private void initGraphics() {
// Set initial size
if (Double.compare(getSkinnable().getPrefWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getPrefHeight(), 0.0) <= 0 ||
Double.compare(getSkinnable().getWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getHeight(), 0.0) <= 0) {
if (getSkinnable().getPrefWidth() > 0 && getSkinnable().getPrefHeight() > 0) {
getSkinnable().setPrefSize(getSkinnable().getPrefWidth(), getSkinnable().getPrefHeight());
} else {
getSkinnable().setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
pane = new Pane();
pane.setBorder(new Border(new BorderStroke(getSkinnable().getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1))));
pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
getChildren().setAll(pane);
}
项目:Medusa
文件:KpiSkin.java
@Override protected void redraw() {
pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
locale = gauge.getLocale();
titleText.setText(gauge.getTitle());
minValueText.setText(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMinValue()));
maxValueText.setText(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMaxValue()));
thresholdText.setText(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getThreshold()));
resizeStaticText();
barBackground.setStroke(gauge.getBarColor());
thresholdBar.setStroke(gauge.getThresholdColor());
needle.setFill(gauge.getNeedleColor());
titleText.setFill(gauge.getTitleColor());
minValueText.setFill(gauge.getTitleColor());
maxValueText.setFill(gauge.getTitleColor());
thresholdText.setFill(gauge.getTitleColor());
valueText.setFill(gauge.getValueColor());
thresholdText.setVisible(Double.compare(gauge.getThreshold(), gauge.getMinValue()) != 0 && Double.compare(gauge.getThreshold(), gauge.getMaxValue()) != 0);
}
项目:Medusa
文件:SlimSkin.java
@Override protected void redraw() {
pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
colorGradientEnabled = gauge.isGradientBarEnabled();
noOfGradientStops = gauge.getGradientBarStops().size();
sectionsVisible = gauge.getSectionsVisible();
titleText.setText(gauge.getTitle());
unitText.setText(gauge.getUnit());
resizeStaticText();
barBackground.setStroke(gauge.getBarBackgroundColor());
setBarColor(gauge.getCurrentValue());
titleText.setFill(gauge.getTitleColor());
valueText.setFill(gauge.getValueColor());
unitText.setFill(gauge.getUnitColor());
}
项目:medusademo
文件:CustomGaugeSkin.java
private void initGraphics() {
backgroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
backgroundCtx = backgroundCanvas.getGraphicsContext2D();
foregroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
foregroundCtx = foregroundCanvas.getGraphicsContext2D();
ledInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 0.2 * PREFERRED_WIDTH, 0, 0, 0);
ledDropShadow = new DropShadow(BlurType.TWO_PASS_BOX, getSkinnable().getBarColor(), 0.3 * PREFERRED_WIDTH, 0, 0, 0);
pane = new Pane(backgroundCanvas, foregroundCanvas);
pane.setBorder(new Border(new BorderStroke(getSkinnable().getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1))));
pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
getChildren().setAll(pane);
}
项目:Medusa
文件:SpaceXSkin.java
@Override protected void redraw() {
pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * width))));
pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
barColor = gauge.getBarColor();
thresholdColor = gauge.getThresholdColor();
barBackgroundColor = gauge.getBarBackgroundColor();
thresholdBackgroundColor = Color.color(thresholdColor.getRed(), thresholdColor.getGreen(), thresholdColor.getBlue(), 0.25);
barBackground.setFill(barBackgroundColor);
thresholdBar.setFill(thresholdBackgroundColor);
dataBar.setFill(barColor);
dataBarThreshold.setFill(thresholdColor);
titleText.setFill(gauge.getTitleColor());
titleText.setText(gauge.getTitle());
valueText.setFill(gauge.getValueColor());
valueText.setText(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue()));
valueText.relocate((width - valueText.getLayoutBounds().getWidth()), 0.58064516 * height);
unitText.setFill(gauge.getUnitColor());
unitText.setText(gauge.getUnit());
unitText.relocate((width - unitText.getLayoutBounds().getWidth()), 0.79 * height);
}
项目:medusademo
文件:CombinedGauges.java
@Override public void start(Stage stage) {
Pane pane = new Pane(bigGauge, smallGauge);
pane.setBackground(new Background(new BackgroundFill(Gauge.DARK_COLOR, CornerRadii.EMPTY, Insets.EMPTY)));
bigGauge.relocate(0, 0);
smallGauge.relocate(0, 230);
Scene scene = new Scene(pane);
stage.setScene(scene);
stage.show();
timer.start();
// Calculate number of nodes
calcNoOfNodes(pane);
System.out.println(noOfNodes + " Nodes in SceneGraph");
}
项目:medusademo
文件:CustomGaugeSkinDemo.java
@Override public void start(Stage stage) {
HBox pane = new HBox(gauge0, gauge1, gauge2, gauge3, gauge4, gauge5, gauge6, gauge7, gauge8, gauge9);
pane.setBackground(new Background(new BackgroundFill(Gauge.DARK_COLOR, CornerRadii.EMPTY, Insets.EMPTY)));
pane.setPadding(new Insets(10));
Scene scene = new Scene(pane);
stage.setTitle("Medusa Custom Gauge Skin");
stage.setScene(scene);
stage.show();
timer.start();
// Calculate number of nodes
calcNoOfNodes(pane);
System.out.println(noOfNodes + " Nodes in SceneGraph");
}
项目:openjfx-8u-dev-tests
文件:RT_17348Test.java
@Test
public void changeStylesheetTest() {
Wrap<? extends Scene> scene = Root.ROOT.lookup(Scene.class).wrap();
Parent<Node> sceneParent = scene.as(Parent.class, Node.class);
final Wrap<Region> pane = (Wrap<Region>) sceneParent.lookup(new ByID<Node>(StylesheetApp.EXAMPLE_ID)).wrap();
Assert.assertNotNull(pane);
Assert.assertNotNull(pane.getControl().backgroundProperty().get());
Assert.assertEquals(pane.getControl().backgroundProperty().get(), new Background(new BackgroundFill(Color.RED, CornerRadii.EMPTY, Insets.EMPTY)));
Assert.assertNotSame(pane.getControl().backgroundProperty().get(), new Background(new BackgroundFill(Color.BLUE, CornerRadii.EMPTY, Insets.EMPTY)));
Wrap<? extends Text> button = sceneParent.lookup(Text.class).wrap();
button.mouse().click();
pane.waitState(new State() {
@Override
public Object reached() {
return !pane.getControl().backgroundProperty().get().equals(new Background(new BackgroundFill(Color.RED, CornerRadii.EMPTY, Insets.EMPTY))) ? true : null;
}
});
Assert.assertNotNull(pane.getControl().backgroundProperty().get());
Assert.assertEquals(pane.getControl().backgroundProperty().get(), new Background(new BackgroundFill(Color.BLUE, CornerRadii.EMPTY, Insets.EMPTY)));
Assert.assertNotSame(pane.getControl().backgroundProperty().get(), new Background(new BackgroundFill(Color.RED, CornerRadii.EMPTY, Insets.EMPTY)));
}
项目:cardnav
文件:Card.java
public Card(final String TITLE) {
getStylesheets().add(Card.class.getResource("card.css").toExternalForm());
cardColor = new StyleableObjectProperty<Color>(Color.web("#dae18f")) {
@Override protected void invalidated() { container.setBackground(new Background(new BackgroundFill(get(), CornerRadii.EMPTY, Insets.EMPTY))); }
@Override public Object getBean() { return Card.this; }
@Override public String getName() { return "cardColor"; }
@Override public CssMetaData<? extends Styleable, Color> getCssMetaData() { return CARD_COLOR; }
};
titleColor = new StyleableObjectProperty<Color>(Color.BLACK) {
@Override protected void invalidated() { titleText.setTextFill(get()); }
@Override public Object getBean() { return Card.this; }
@Override public String getName() { return "titleColor"; }
@Override public CssMetaData<? extends Styleable, Color> getCssMetaData() { return TITLE_COLOR; }
};
title = new StringPropertyBase(TITLE) {
@Override protected void invalidated() { titleText.setText(get()); }
@Override public Object getBean() { return Card.this; }
@Override public String getName() { return "title"; }
};
init();
initGraphics();
registerListeners();
}
项目:hol1634
文件:MyControlSkin.java
private void initGraphics() {
// Set initial size
if (Double.compare(getSkinnable().getPrefWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getPrefHeight(), 0.0) <= 0 ||
Double.compare(getSkinnable().getWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getHeight(), 0.0) <= 0) {
if (getSkinnable().getPrefWidth() > 0 && getSkinnable().getPrefHeight() > 0) {
getSkinnable().setPrefSize(getSkinnable().getPrefWidth(), getSkinnable().getPrefHeight());
} else {
getSkinnable().setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
node = new Region();
node.getStyleClass().setAll("node");
pane = new Pane(node);
pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));
getChildren().setAll(pane);
}
项目:Medusa
文件:SimpleDigitalSkin.java
@Override protected void redraw() {
pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
barColor = gauge.getBarColor();
valueColor = gauge.getValueColor();
unitColor = gauge.getUnitColor();
sectionsVisible = gauge.getSectionsVisible();
drawBackground();
resizeStaticText();
setBar(gauge.getCurrentValue());
titleText.setText(gauge.getTitle());
titleText.setFill(gauge.getTitleColor());
titleText.relocate((size - titleText.getLayoutBounds().getWidth()) * 0.5, size * 0.22180451);
valueBkgText.setFill(Helper.getTranslucentColorFrom(valueColor, 0.1));
valueText.setFill(valueColor);
}
项目:Medusa
文件:TileSparklineSkin.java
@Override protected void redraw() {
pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(size * 0.025), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(size * 0.025), Insets.EMPTY)));
locale = gauge.getLocale();
formatString = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f").toString();
titleText.setText(gauge.getTitle());
subTitleText.setText(gauge.getSubTitle());
resizeStaticText();
titleText.setFill(gauge.getTitleColor());
valueText.setFill(gauge.getValueColor());
averageText.setFill(gauge.getAverageColor());
highText.setFill(gauge.getValueColor());
lowText.setFill(gauge.getValueColor());
subTitleText.setFill(gauge.getSubTitleColor());
sparkLine.setStroke(gauge.getBarColor());
stdDeviationArea.setFill(Helper.getTranslucentColorFrom(gauge.getAverageColor(), 0.1));
averageLine.setStroke(gauge.getAverageColor());
dot.setFill(gauge.getBarColor());
}
项目:Medusa
文件:DigitalClockSkin.java
@Override protected void initGraphics() {
// Set initial size
if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 ||
Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) {
if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) {
clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight());
} else {
clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
ctx = canvas.getGraphicsContext2D();
pane = new Pane(canvas);
pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(clock.getBorderWidth()))));
pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
getChildren().setAll(pane);
}
项目:Medusa
文件:RoundLcdClockSkin.java
@Override protected void redraw() {
pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth() / PREFERRED_WIDTH * size))));
pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
ZonedDateTime time = clock.getTime();
hourColor = clock.getHourColor();
minuteColor = clock.getMinuteColor();
fiveMinuteColor = minuteColor.darker();
secondColor = clock.getSecondColor();
titleColor = clock.getTitleColor();
textColor = clock.getTextColor();
dateColor = clock.getDateColor();
alarmColor = clock.getAlarmColor();
drawBackground();
drawForeground(time);
drawHours(time);
drawMinutes(time);
drawSeconds(time);
}
项目:Medusa
文件:DashboardSkin.java
@Override protected void redraw() {
pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth() / 250 * size))));
pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
colorGradientEnabled = gauge.isGradientBarEnabled();
noOfGradientStops = gauge.getGradientBarStops().size();
sectionsVisible = gauge.getSectionsVisible();
barBackground.setFill(gauge.getBarBackgroundColor());
barBackground.setEffect(gauge.isShadowsEnabled() ? innerShadow : null);
setBarColor(gauge.getCurrentValue());
dataBar.setEffect(gauge.isShadowsEnabled() ? innerShadow : null);
threshold.setStroke(gauge.getThresholdColor());
double thresholdInnerRadius = 0.3 * height;
double thresholdOuterRadius = 0.675 * height;
double thresholdAngle = Helper.clamp(90.0, 270.0, (gauge.getThreshold() - minValue) * angleStep + 90.0);
threshold.setStartX(centerX + thresholdInnerRadius * Math.sin(-Math.toRadians(thresholdAngle)));
threshold.setStartY(centerX + thresholdInnerRadius * Math.cos(-Math.toRadians(thresholdAngle)));
threshold.setEndX(centerX + thresholdOuterRadius * Math.sin(-Math.toRadians(thresholdAngle)));
threshold.setEndY(centerX + thresholdOuterRadius * Math.cos(-Math.toRadians(thresholdAngle)));
redrawText();
}
项目:Medusa
文件:TextClockSkin.java
@Override protected void initGraphics() {
// Set initial size
if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 ||
Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) {
if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) {
clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight());
} else {
clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
timeText = new Text();
timeText.setTextOrigin(VPos.CENTER);
timeText.setFill(textColor);
dateText = new Text();
dateText.setTextOrigin(VPos.CENTER);
dateText.setFill(dateColor);
pane = new Pane(timeText, dateText);
pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(clock.getBorderWidth()))));
pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
getChildren().setAll(pane);
}
项目:hygene
文件:PathController.java
@Override
public void initialize(final URL location, final ResourceBundle resources) {
nameColumn.setCellValueFactory(cell -> {
if (cell.getValue().getName() == null) {
return new SimpleStringProperty("[unknown genome]");
} else {
return new SimpleStringProperty(cell.getValue().getName());
}
});
colorColumn.setCellValueFactory(cell -> cell.getValue().getColor());
colorColumn.setCellFactory(cell -> new TableCell<GenomePath, Color>() {
@Override
protected void updateItem(final Color color, final boolean empty) {
super.updateItem(color, empty);
if (color == null) {
setBackground(Background.EMPTY);
} else {
setBackground(new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)));
}
}
});
selectedColumn.setCellValueFactory(cell -> cell.getValue().selectedProperty());
selectedColumn.setCellFactory(CheckBoxTableCell.forTableColumn(selectedColumn));
final FilteredList<GenomePath> filteredList = new FilteredList<>(graphVisualizer.getGenomePathsProperty(),
s -> s.getName().contains(searchField.textProperty().get()));
pathTable.setItems(filteredList);
pathTable.setEditable(true);
addListeners();
}
项目:SunburstChart
文件:SunburstChart.java
private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight());
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
segmentPane = new Pane();
chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
chartCanvas.setMouseTransparent(true);
chartCtx = chartCanvas.getGraphicsContext2D();
pane = new Pane(segmentPane, chartCanvas);
pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));
getChildren().setAll(pane);
prepareData();
}