本文整理匯總了Java中javafx.scene.layout.BackgroundFill類的典型用法代碼示例。如果您正苦於以下問題:Java BackgroundFill類的具體用法?Java BackgroundFill怎麽用?Java BackgroundFill使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BackgroundFill類屬於javafx.scene.layout包,在下文中一共展示了BackgroundFill類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: start
import javafx.scene.layout.BackgroundFill; //導入依賴的package包/類
@Override public void start(Stage stage) {
StackPane pane = new StackPane(graph);
pane.setPadding(new Insets(10));
pane.setBackground(new Background(new BackgroundFill(Color.rgb(40, 40, 40), CornerRadii.EMPTY, Insets.EMPTY)));
Scene scene = new Scene(pane);
stage.setTitle("Radial Chart");
stage.setScene(scene);
stage.show();
timer.start();
}
示例2: initGraphics
import javafx.scene.layout.BackgroundFill; //導入依賴的package包/類
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);
}
示例3: handleLaunchGameClick
import javafx.scene.layout.BackgroundFill; //導入依賴的package包/類
@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)));
}
示例4: start
import javafx.scene.layout.BackgroundFill; //導入依賴的package包/類
@Override public void start(Stage stage) {
HBox pane = new HBox(imageView, matrix);
pane.setSpacing(10);
pane.setPadding(new Insets(10));
pane.setBackground(new Background(new BackgroundFill(Color.rgb(10, 10, 20), CornerRadii.EMPTY, Insets.EMPTY)));
Scene scene = new Scene(pane);
stage.setTitle("Matrix Image");
stage.setScene(scene);
stage.show();
timer.start();
}
示例5: setLegendSymbolFill
import javafx.scene.layout.BackgroundFill; //導入依賴的package包/類
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)));
}
示例6: start
import javafx.scene.layout.BackgroundFill; //導入依賴的package包/類
@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();
}
示例7: getDemoPane
import javafx.scene.layout.BackgroundFill; //導入依賴的package包/類
public GridPane getDemoPane() {
GridPane pane = new GridPane();
pane.add(framedGauge1, 0, 0);
pane.add(framedGauge2, 1, 0);
pane.add(gauge3, 2, 0);
pane.add(gauge4, 3, 0);
pane.add(gauge5, 4, 0);
pane.add(clock1, 5, 0);
pane.add(clock5, 6, 0);
pane.add(gauge22, 7, 0);
pane.add(gauge29, 8, 0);
pane.add(gauge6, 0, 1);
pane.add(gauge7, 1, 1);
pane.add(gauge8, 2, 1);
pane.add(gauge9, 3, 1);
pane.add(gauge10, 4, 1);
pane.add(clock2, 5, 1);
pane.add(gauge21, 6, 1);
pane.add(gauge23, 7, 1);
pane.add(gauge30, 8, 1);
pane.add(gauge11, 0, 2);
pane.add(gauge12, 1, 2);
pane.add(gauge13, 2, 2);
pane.add(gauge14, 3, 2);
pane.add(gauge15, 4, 2);
pane.add(clock3, 5, 2);
pane.add(clock6, 6, 2);
pane.add(clock8, 7, 2);
pane.add(gauge31, 8, 2);
pane.add(gauge16, 0, 3);
pane.add(gauge17, 1, 3);
pane.add(gauge18, 2, 3);
pane.add(gauge19, 3, 3);
pane.add(gauge20, 4, 3);
pane.add(clock4, 5, 3);
pane.add(clock7, 6, 3);
pane.add(gauge24, 7, 3);
pane.add(clock12, 8, 3);
pane.add(gauge25, 0, 4);
pane.add(gauge26, 1, 4);
pane.add(gauge27, 2, 4);
pane.add(gauge28, 4, 4);
pane.add(clock9, 5, 4);
pane.add(clock10, 6, 4);
pane.add(clock11, 7, 4);
pane.setHgap(10);
pane.setVgap(10);
pane.setPadding(new Insets(10));
for (int i = 0 ; i < 9 ; i++) {
pane.getColumnConstraints().add(new ColumnConstraints(MIN_CELL_SIZE, PREF_CELL_SIZE, MAX_CELL_SIZE));
}
for (int i = 0 ; i < 5 ; i++) {
pane.getRowConstraints().add(new RowConstraints(MIN_CELL_SIZE, PREF_CELL_SIZE, MAX_CELL_SIZE));
}
pane.setBackground(new Background(new BackgroundFill(Color.rgb(90, 90, 90), CornerRadii.EMPTY, Insets.EMPTY)));
return pane;
}
示例8: addYourMessges
import javafx.scene.layout.BackgroundFill; //導入依賴的package包/類
/**
* 將自己的對話添加到對話列表中
* @param content
*/
public void addYourMessges(String content){
Platform.runLater(() ->{
//尋找用戶的頭像名
Image image = new Image("images/" + userPic);
ImageView profileImage = new ImageView(image);
profileImage.setFitHeight(32);
profileImage.setFitWidth(32);
BubbledTextFlow yourBubbled = new BubbledTextFlow(EmojiDisplayer.createEmojiAndTextNode(content));
yourBubbled.setBackground(new Background(new BackgroundFill(Color.LIGHTGREEN,
null, null)));
HBox x = new HBox();
x.setMaxWidth(chatPaneListView.getWidth() - 20);
x.setAlignment(Pos.TOP_RIGHT);
yourBubbled.setBubbleSpec(BubbleSpec.FACE_RIGHT_CENTER);
x.getChildren().addAll(yourBubbled, profileImage);
chatPaneListView.getItems().add(x);
});
}
示例9: addNotification
import javafx.scene.layout.BackgroundFill; //導入依賴的package包/類
/**
* 處理通知信息的顯示
* @param notice
*/
public void addNotification(String notice){
Platform.runLater(() ->{
SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");//設置日期格式
String timer = df.format(new Date());// new Date()為獲取當前係統時間
String content = timer + ": " + notice;
BubbledTextFlow noticeBubbled = new BubbledTextFlow(EmojiDisplayer.createEmojiAndTextNode(content));
//noticeBubbled.setTextFill(Color.web("#031c30"));
noticeBubbled.setBackground(new Background(new BackgroundFill(Color.WHITE,
null, null)));
HBox x = new HBox();
//x.setMaxWidth(chatPaneListView.getWidth() - 20);
x.setAlignment(Pos.TOP_CENTER);
noticeBubbled.setBubbleSpec(BubbleSpec.FACE_TOP);
x.getChildren().addAll(noticeBubbled);
chatPaneListView.getItems().add(x);
});
}
示例10: initGraphics
import javafx.scene.layout.BackgroundFill; //導入依賴的package包/類
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();
}
示例11: generate
import javafx.scene.layout.BackgroundFill; //導入依賴的package包/類
/**
* 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 ;
}
示例12: initGraphics
import javafx.scene.layout.BackgroundFill; //導入依賴的package包/類
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);
}
示例13: redraw
import javafx.scene.layout.BackgroundFill; //導入依賴的package包/類
@Override protected void redraw() {
colorGradientEnabled = gauge.isGradientBarEnabled();
noOfGradientStops = gauge.getGradientBarStops().size();
sectionsVisible = gauge.getSectionsVisible();
pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
setBarColor(gauge.getCurrentValue());
valueText.setFill(gauge.getValueColor());
unitText.setFill(gauge.getUnitColor());
titleText.setFill(gauge.getTitleColor());
separator.setStroke(gauge.getBorderPaint());
titleText.setText(gauge.getTitle());
resizeTitleText();
unitText.setText(gauge.getUnit());
resizeUnitText();
}
示例14: redraw
import javafx.scene.layout.BackgroundFill; //導入依賴的package包/類
@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);
}
示例15: resize
import javafx.scene.layout.BackgroundFill; //導入依賴的package包/類
private void resize() {
double width = getWidth() - getInsets().getLeft() - getInsets().getRight();
double height = getHeight() - getInsets().getTop() - getInsets().getBottom();
size = width < height ? width : height;
if (size > 0) {
pane.setMaxSize(size, size);
pane.relocate((getWidth() - size) * 0.5, (getHeight() - size) * 0.5);
pane.setBackground(new Background(new BackgroundFill(getChartBackgroundColor(), new CornerRadii(1024), Insets.EMPTY)));
chartCanvas.setWidth(size);
chartCanvas.setHeight(size);
overlayCanvas.setWidth(size);
overlayCanvas.setHeight(size);
redraw();
}
}