本文整理匯總了Java中javafx.scene.paint.Paint類的典型用法代碼示例。如果您正苦於以下問題:Java Paint類的具體用法?Java Paint怎麽用?Java Paint使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Paint類屬於javafx.scene.paint包,在下文中一共展示了Paint類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: MatrixPane
import javafx.scene.paint.Paint; //導入依賴的package包/類
public MatrixPane(final Paint BACKGROUND, final MatrixItemSeries<T> SERIES) {
getStylesheets().add(XYPane.class.getResource("chart.css").toExternalForm());
aspectRatio = PREFERRED_HEIGHT / PREFERRED_WIDTH;
keepAspect = false;
_chartBackground = BACKGROUND;
series = SERIES;
matrixGradient = ColorMapping.BLUE_CYAN_GREEN_YELLOW_RED.getGradient();
scaleX = 1;
scaleY = 1;
scaleZ = 1;
_lowerBoundX = 0;
_upperBoundX = 100;
_lowerBoundY = 0;
_upperBoundY = 100;
_lowerBoundZ = 0;
_upperBoundZ = 100;
initGraphics();
registerListeners();
}
示例2: updatePaint
import javafx.scene.paint.Paint; //導入依賴的package包/類
public void updatePaint() {
/* Update the color */
/* Set a special paint for multi-state intervals */
if (fInterval.isMultiState()) {
Paint multiStatePaint = fWidget.getDebugOptions().multiStatePaint.get();
fBaseColor = multiStatePaint;
fSelectedColor = multiStatePaint;
} else {
fBaseColor = JfxColorFactory.getColorFromDef(fInterval.getColorDefinition().get());
fSelectedColor = JfxColorFactory.getDerivedColorFromDef(fInterval.getColorDefinition().get());
}
setFill(fBaseColor);
/* Update the line thickness */
LineThickness lt = fInterval.getLineThickness().get();
double height = getHeightFromThickness(lt);
setHeight(height);
/* We need to adjust the y position too */
setY(computeY(height));
}
示例3: chartBackgroundProperty
import javafx.scene.paint.Paint; //導入依賴的package包/類
public ObjectProperty<Paint> chartBackgroundProperty() {
if (null == chartBackground) {
chartBackground = new ObjectPropertyBase<Paint>(_chartBackground) {
@Override protected void invalidated() { redraw(); }
@Override public Object getBean() { return XYPane.this; }
@Override public String getName() { return "chartBackground"; }
};
_chartBackground = null;
}
return chartBackground;
}
示例4: createText
import javafx.scene.paint.Paint; //導入依賴的package包/類
/**
* Creates the title and description text.
* @return Returns a VBox containing the data.
*/
public VBox createText(){
final VBox layout = new VBox(15.0f);
layout.setAlignment(Pos.CENTER_LEFT);
layout.setPadding(new Insets(10,10,10,10));
layout.setMaxWidth(300.0f);
lblTitle = new Label(this.title);
lblTitle.setTextFill(javafx.scene.paint.Paint.valueOf("#ff0000"));
lblTitle.setFont( javafx.scene.text.Font.font(FONT_NAME, FontWeight.EXTRA_BOLD,FONT_SIZE) );
txtDescription = new Text(this.description);
txtDescription.setFill(Paint.valueOf("#ffffff"));
txtDescription.setFont( javafx.scene.text.Font.font(FONT_NAME, FontWeight.BOLD,12.0f) );
txtDescription.setBoundsType(TextBoundsType.LOGICAL_VERTICAL_CENTER);
layout.getChildren().add(lblTitle);
layout.getChildren().add(txtDescription);
return layout;
}
示例5: stopAction
import javafx.scene.paint.Paint; //導入依賴的package包/類
@FXML
void stopAction(ActionEvent event) {
double val = Double.valueOf(offset_textfield.getText());
setOffset(val);
showHUD();
// Called when moving a gradient stop :
// - update gradient preview accordingly
// - update model
final PaintPickerController paintPicker
= gradientPicker.getPaintPickerController();
final Mode mode = paintPicker.getMode();
final Paint value = gradientPicker.getValue(mode);
gradientPicker.updatePreview(value);
// Update model
paintPicker.setPaintProperty(value);
}
示例6: CycleView
import javafx.scene.paint.Paint; //導入依賴的package包/類
public CycleView(final List<Node> nodes, final int cycleIndex, final double hueInterval) {
Paint p = Color.hsb(cycleIndex * hueInterval, 0.75, 0.70, 0.25);
setFill(p);
setStroke(p);
setStrokeWidth(20);
setStrokeLineJoin(StrokeLineJoin.ROUND);
setStrokeType(StrokeType.OUTSIDE);
updateHull(nodes, HULL_ALGORITHM);
final ChangeListener<Number> listener = (_0, _1, _2) -> {
updateHull(nodes, HULL_ALGORITHM);
};
for (Node n : nodes) {
n.translateXProperty().addListener(listener);
n.translateYProperty().addListener(listener);
}
}
示例7: getGlyph
import javafx.scene.paint.Paint; //導入依賴的package包/類
public static SVGGlyph getGlyph(String name, Paint fill) {
String path;
switch (name) {
case "repeat":
path = repeat;
break;
case "check_circle":
path = check_circle;
break;
case "check_circle_o":
path = check_circle_o;
break;
case "save":
path = save;
break;
case "download":
path = download;
break;
default:
path = plane;
}
return new SVGGlyph(-1, name, path, fill);
}
示例8: displayNotification
import javafx.scene.paint.Paint; //導入依賴的package包/類
private void displayNotification() {
Image gmrLogo = new Image(getClass().getResourceAsStream("GMRLogo.png"));
notification = new TrayNotification("It's your turn", "It's your turn in " + playerGames.size() + " games", Notifications.SUCCESS);
notification.setRectangleFill(Paint.valueOf("#565656"));
notification.setImage(gmrLogo);
notification.setAnimation(Animations.POPUP);
notification.showAndDismiss(Duration.seconds(15));
}
示例9: getPaint
import javafx.scene.paint.Paint; //導入依賴的package包/類
private static Paint getPaint(IPixel p)
{
switch (p.getColor())
{
case 0:
return (Color.RED);
case 1:
return (Color.LIME);
case 2:
return (Color.BLUE);
case 3:
return (Color.GRAY);
case 4:
return (Color.BLACK);
case 5:
return (Color.WHITE);
default:
throw new IllegalStateException("Invalid color code " + p.getColor() + ".");
}
}
示例10: setLegendTextFill
import javafx.scene.paint.Paint; //導入依賴的package包/類
public void setLegendTextFill(final Series<X, Y> SERIES, final Paint 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; }
String itemText = item.getText();
for (Node node : legend.lookupAll(".chart-legend-item")) {
if (node instanceof Label) {
Label label = (Label) node;
if (label.getText().equals(itemText)) { label.setTextFill(FILL); }
}
}
}
示例11: drawStone
import javafx.scene.paint.Paint; //導入依賴的package包/類
private void drawStone(DrawCoords position, StoneColour colour, double radius) {
GraphicsContext context = getGraphicsContext();
if ( colour == BLACK )
context.setFill(javafx.scene.paint.Paint.valueOf("#000000"));
else
context.setFill(Paint.valueOf("#FFFFFF"));
drawCircle(position, radius);
}
示例12: majorVGridLinePaintProperty
import javafx.scene.paint.Paint; //導入依賴的package包/類
public ObjectProperty<Paint> majorVGridLinePaintProperty() {
if (null == majorVGridLinePaint) {
majorVGridLinePaint = new ObjectPropertyBase<Paint>(_majorVGridLinePaint) {
@Override protected void invalidated() { drawGrid(); }
@Override public Object getBean() { return Grid.this; }
@Override public String getName() { return "majorVGridLinePaint"; }
};
_majorVGridLinePaint = null;
}
return majorVGridLinePaint;
}
示例13: handleChange
import javafx.scene.paint.Paint; //導入依賴的package包/類
/**
* Handle changes to the input fields
*/
public void handleChange()
{
// Check the input fields:
if (!this.name.getText().trim().isEmpty() &&
!this.weighting.getText().trim().isEmpty() &&
!this.deadline.getEditor().getText().trim().isEmpty() && !this.deadline.getValue().isBefore(LocalDate.now()) &&
this.taskType.getSelectionModel().getSelectedIndex() != -1)
this.submit.setDisable(false);
// =================
// Process requirements and dependencies:
if (this.task != null)
{
this.task.replaceDependencies(this.dependencies.getItems());
this.task.replaceRequirements(this.requirements.getItems());
if (!this.task.isCheckedComplete() && this.task.canCheckComplete())
{
this.canComplete.setText("Can be completed.");
this.canComplete.setTextFill(Paint.valueOf("green"));
this.canComplete.setVisible(true);
this.markComplete.setDisable(false);
} else if (!this.task.canCheckComplete())
{
this.task.setComplete(false);
this.canComplete.setText("Cannot be completed at this point.");
this.canComplete.setTextFill(Paint.valueOf("red"));
this.canComplete.setVisible(true);
this.markComplete.setDisable(true);
}
}
// =================
}
示例14: LineThicknessMenuButton
import javafx.scene.paint.Paint; //導入依賴的package包/類
public LineThicknessMenuButton(TimeGraphWidget widget,
ConfigOption<LineThickness> option,
ReadOnlyProperty<? extends Paint> colorSource) {
fOption = option;
fColorSource = colorSource;
ToggleGroup tg = new ToggleGroup();
List<LineThicknessMenuButtonItem> items = Arrays.stream(LineThickness.values())
.map(lt -> {
LineThicknessMenuButtonItem rmi = new LineThicknessMenuButtonItem(lt);
rmi.setGraphic(getRectangleForThickness(lt));
rmi.setToggleGroup(tg);
LineThickness currentThickness = option.get();
rmi.setSelected(lt == currentThickness);
rmi.setOnAction(e -> {
option.set(lt);
LineThicknessMenuButton.this.setGraphic(getRectangleForThickness(lt));
repaintAllRectangles(widget);
});
return rmi;
})
.collect(Collectors.toList());
/* Initial value shown in the button */
setGraphic(getRectangleForThickness(option.get()));
getItems().addAll(items);
}
示例15: prepareArrows
import javafx.scene.paint.Paint; //導入依賴的package包/類
private Collection<Arrow> prepareArrows(TimeGraphTreeRender treeRender,
TimeGraphArrowRender arrowRender, Paint arrowStroke) {
final double entryHeight = TimeGraphWidget.ENTRY_HEIGHT;
Collection<Arrow> arrows = arrowRender.getArrows().stream()
.map(timeGraphArrow -> {
TimeGraphTreeElement startTreeElem = timeGraphArrow.getStartEvent().getTreeElement();
TimeGraphTreeElement endTreeElem = timeGraphArrow.getEndEvent().getTreeElement();
long startTimestamp = timeGraphArrow.getStartEvent().getTimestamp();
long endTimestamp = timeGraphArrow.getEndEvent().getTimestamp();
// FIXME Build and use a hashmap instead for indexes
int startIndex = treeRender.getAllTreeElements().indexOf(startTreeElem);
int endIndex = treeRender.getAllTreeElements().indexOf(endTreeElem);
if (startIndex == -1 || endIndex == -1) {
/* We shouldn't have received this... */
return null;
}
double startX = getWidget().timestampToPaneXPos(startTimestamp);
double endX = getWidget().timestampToPaneXPos(endTimestamp);
double startY = startIndex * entryHeight + entryHeight / 2;
double endY = endIndex * entryHeight + entryHeight / 2;
Arrow arrow = new Arrow(startX, startY, endX, endY);
arrow.setStroke(arrowStroke);
return arrow;
})
.filter(Objects::nonNull)
.collect(Collectors.toList());
return arrows;
}