本文整理匯總了Java中javafx.scene.layout.Pane.setBackground方法的典型用法代碼示例。如果您正苦於以下問題:Java Pane.setBackground方法的具體用法?Java Pane.setBackground怎麽用?Java Pane.setBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.layout.Pane
的用法示例。
在下文中一共展示了Pane.setBackground方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initGraphics
import javafx.scene.layout.Pane; //導入方法依賴的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();
}
示例2: initGraphics
import javafx.scene.layout.Pane; //導入方法依賴的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);
}
}
canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
ctx = canvas.getGraphicsContext2D();
pane = new Pane(canvas);
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);
}
示例3: createTraceWidget
import javafx.scene.layout.Pane; //導入方法依賴的package包/類
private Pane createTraceWidget(ITraceExtractor<Step<?>, State<?,?>, TracedObject<?>, Dimension<?>, Value<?>> extractor, String label, ReadOnlyDoubleProperty width) {
final Pane pane = new Pane();
pane.setBackground(TRANSPARENT_BACKGROUND);
final Rectangle rectangle = new Rectangle(0, 0, 0, 12);
rectangle.setFill(Color.LIGHTGRAY);
rectangle.widthProperty().bind(width.subtract(10));
rectangle.setArcHeight(12);
rectangle.setArcWidth(12);
Label text = new Label(label);
text.setTextOverrun(OverrunStyle.ELLIPSIS);
text.setAlignment(Pos.CENTER);
text.setMouseTransparent(true);
text.setTextFill(Color.WHITE);
text.setFont(FONT);
text.setMaxWidth(0);
text.maxWidthProperty().bind(rectangle.widthProperty());
StackPane layout = new StackPane();
layout.getChildren().addAll(rectangle, text);
pane.getChildren().add(layout);
layout.setTranslateY(13);
layout.setTranslateX(5);
pane.setPrefHeight(25);
pane.setMinHeight(25);
pane.setMaxHeight(25);
final Shape arrow1 = createCursor();
final Shape arrow2 = createCursor();
arrow1.setTranslateX(5);
arrow1.setTranslateY(4);
arrow2.translateXProperty().bind(rectangle.widthProperty().add(5));
arrow2.setTranslateY(4);
pane.getChildren().add(arrow1);
pane.getChildren().add(arrow2);
return pane;
}
示例4: overlay
import javafx.scene.layout.Pane; //導入方法依賴的package包/類
protected static Parent overlay(EncoderParameters params,
int yMin, int cMid, boolean redChroma) {
int yMax = yMin + COLS - 1;
int midRow = ROWS / 2;
int midCol = COLS / 2;
int cMin = cMid - midRow;
int cMax = cMid + midRow;
YCbCr matrix = params.matrix;
Color color = yMin > matrix.YMIN * 3 ? BLACK
: gray(matrix.fromLumaCode(yMin + matrix.YMIN * 6));
String cName = redChroma ? "C'r" : "C'b";
Resolution res = params.resolution;
Pane grid = new Pane(
text(res, "Y'\nC" + yMin, color, 0, midRow),
text(res, "→", color, 1, midRow),
text(res, "→", color, COLS - 2, midRow),
text(res, "Y'\nC" + yMax, color, COLS - 1, midRow),
text(res, cName + "\nC" + cMin, color, midCol, 0),
text(res, "↓", color, midCol, 1),
text(res, "↓", color, midCol, ROWS - 2),
text(res, cName + "\nC" + cMax, color, midCol, ROWS - 1));
color = color(0.125, 0.0, 0.0);
for (int yCode = yMin; yCode <= yMax; yCode++) {
for (int cCode = cMin; cCode <= cMax; cCode++) {
if (!isValidColor(matrix, yCode, cCode, redChroma)) {
grid.getChildren().add(
text(res, "X", color, yCode - yMin, cCode - cMin));
}
}
}
grid.setBackground(EMPTY);
return grid;
}
示例5: overlay
import javafx.scene.layout.Pane; //導入方法依賴的package包/類
protected static Parent overlay(EncoderParameters params) {
Resolution resolution = params.resolution;
YCbCr matrix = params.matrix;
Pane grid = new Pane();
range(0, COLS).mapToObj(col -> top(resolution, matrix, col))
.forEach(grid.getChildren()::add);
range(0, COLS).mapToObj(col -> bottom(resolution, matrix, col))
.forEach(grid.getChildren()::add);
grid.setBackground(EMPTY);
return grid;
}