当前位置: 首页>>代码示例>>Java>>正文


Java Paint类代码示例

本文整理汇总了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();
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:21,代码来源:MatrixPane.java

示例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));
}
 
开发者ID:lttng,项目名称:lttng-scope,代码行数:21,代码来源:StateRectangle.java

示例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;
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:12,代码来源:XYPane.java

示例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;

}
 
开发者ID:Theldus,项目名称:PSE,代码行数:27,代码来源:ItemViewAdapter.java

示例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);
}
 
开发者ID:EricCanull,项目名称:fxexperience2,代码行数:17,代码来源:GradientPickerStop.java

示例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);
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:17,代码来源:CycleView.java

示例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);
}
 
开发者ID:b3log,项目名称:JHosts,代码行数:24,代码来源:GlyphSet.java

示例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));
}
 
开发者ID:eternia16,项目名称:javaGMR,代码行数:9,代码来源:JgmrGuiController.java

示例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() + ".");
    }
}
 
开发者ID:AutonomousCarProject,项目名称:AutonomousCar,代码行数:21,代码来源:BlobDetectionRender.java

示例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); }
        }
    }
}
 
开发者ID:HanSolo,项目名称:smoothcharts,代码行数:22,代码来源:SmoothedChart.java

示例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);
}
 
开发者ID:GoSuji,项目名称:Suji,代码行数:11,代码来源:SimpleStoneDrawer.java

示例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;
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:12,代码来源:Grid.java

示例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);
        }
    }
    // =================
}
 
开发者ID:Alienturnedhuman,项目名称:PearPlanner,代码行数:38,代码来源:TaskController.java

示例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);
}
 
开发者ID:lttng,项目名称:lttng-scope,代码行数:30,代码来源:ModelConfigDialog.java

示例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;
}
 
开发者ID:lttng,项目名称:lttng-scope,代码行数:32,代码来源:TimeGraphArrowLayer.java


注:本文中的javafx.scene.paint.Paint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。