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


Java Color.rgb方法代码示例

本文整理汇总了Java中javafx.scene.paint.Color.rgb方法的典型用法代码示例。如果您正苦于以下问题:Java Color.rgb方法的具体用法?Java Color.rgb怎么用?Java Color.rgb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.paint.Color的用法示例。


在下文中一共展示了Color.rgb方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import javafx.scene.paint.Color; //导入方法依赖的package包/类
@Override public void init() {
    int               noOfValues = 24 * 60;
    LocalDateTime     start      = LocalDateTime.now();
    LocalDateTime     end        = start.plusHours(24);
    List<TYChartItem> tyData1    = new ArrayList<>();

    for (int i = 0 ; i < noOfValues ; i++) {
        tyData1.add(new TYChartItem(start.plusMinutes(i), RND.nextDouble() * 12 + RND.nextDouble() * 6, "P" + i, COLORS[RND.nextInt(3)]));
    }

    tySeries1 = new XYSeries(tyData1, ChartType.LINE, Color.RED, Color.rgb(255, 0, 0, 0.5));
    tySeries1.setSymbolsVisible(false);

    // XYChart
    Converter tempConverter     = new Converter(TEMPERATURE, CELSIUS); // Type Temperature with BaseUnit Celsius
    double    tempFahrenheitMin = tempConverter.convert(0, FAHRENHEIT);
    double    tempFahrenheitMax = tempConverter.convert(20, FAHRENHEIT);

    xAxisBottom = createBottomTimeAxis(start, end, "HH:mm", true);
    yAxisLeft   = createLeftYAxis(0, 20, true);
    yAxisRight  = createRightYAxis(tempFahrenheitMin, tempFahrenheitMax, false);
    tyChart     = new XYChart<>(new XYPane(tySeries1), yAxisLeft, yAxisRight, xAxisBottom);
    tyChart.setPrefSize(400, 200);
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:25,代码来源:TimeAxisTest.java

示例2: pickColor

import javafx.scene.paint.Color; //导入方法依赖的package包/类
@Override
public Color pickColor() {
    double r = currentColor.getRed() * MAX_COLOR_VALUE;
    double g = currentColor.getGreen() * MAX_COLOR_VALUE;
    double b = currentColor.getBlue() * MAX_COLOR_VALUE;

    log.info("color = {} {} {}", r, g, b);

    r += INCREMENT;
    if (r > MAX_COLOR_VALUE) {
        r = 0;
        g += INCREMENT;
    }
    if (g > MAX_COLOR_VALUE) {
        g = 0;
        b += INCREMENT;
    }
    if (b > MAX_COLOR_VALUE) {
        b = 0;
    }
    Color color = Color.rgb((int) r, (int) g, (int) b);
    log.info("color = {}", color);
    currentColor = color;
    return color;
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:26,代码来源:ProgressiveColorPicker.java

示例3: baseToColor

import javafx.scene.paint.Color; //导入方法依赖的package包/类
/**
 * Returns the color of a given base.
 * <p>
 * Must be either `A`, `T`, `C` or `G`. If not recognized, simply {@link Color#GRAY}.
 *
 * @param base the base
 * @return the {@link Color}
 */
public static final Color baseToColor(final char base) {
    switch (base) {
        case 'A':
            return Color.rgb(230, 245, 201);
        case 'T':
            return Color.rgb(244, 202, 228);
        case 'C':
            return Color.rgb(203, 213, 232);
        case 'G':
            return Color.rgb(253, 205, 172);
        default:
            return Color.GRAY;
    }
}
 
开发者ID:ProgrammingLife2017,项目名称:hygene,代码行数:23,代码来源:Node.java

示例4: init

import javafx.scene.paint.Color; //导入方法依赖的package包/类
@Override public void init() {
    List<YChartItem> item1 = new ArrayList<>(ELEMENTS);
    List<YChartItem> item2 = new ArrayList<>(ELEMENTS);
    List<YChartItem> item3 = new ArrayList<>(ELEMENTS);
    for (int i = 0 ; i < ELEMENTS ; i++) {
        YChartItem dataPoint;

        dataPoint = new YChartItem(RND.nextDouble() * 100, "P" + i);
        item1.add(dataPoint);

        dataPoint = new YChartItem(RND.nextDouble() * 100, "P" + i);
        item2.add(dataPoint);

        dataPoint = new YChartItem(RND.nextDouble() * 100, "P" + i);
        item3.add(dataPoint);
    }

    series1 = new YSeries(item3, CHART_TYPE, new RadialGradient(0, 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(0, 255, 255, 0.25)), new Stop(0.5, Color.rgb(255, 255, 0, 0.5)), new Stop(1.0, Color.rgb(255, 0, 255, 0.75))), Color.TRANSPARENT);
    series2 = new YSeries(item1, CHART_TYPE, new RadialGradient(0, 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(255, 0, 0, 0.25)), new Stop(0.5, Color.rgb(255, 255, 0, 0.5)), new Stop(1.0, Color.rgb(0, 200, 0, 0.75))), Color.TRANSPARENT);
    series3 = new YSeries(item2, CHART_TYPE, new RadialGradient(0, 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(0, 255, 255, 0.25)), new Stop(0.5, Color.rgb(0, 255, 255, 0.5)), new Stop(1.0, Color.rgb(0, 0, 255, 0.75))), Color.TRANSPARENT);

    chart   = new YChart(new YPane(series1, series2, series3));
    chart.setPrefSize(600, 600);

    timeline      = new Timeline();
    lastTimerCall = System.nanoTime();
    timer         = new AnimationTimer() {
        @Override public void handle(final long now) {
            if (now > lastTimerCall + INTERVAL) {
                animateData();
                long delta = System.nanoTime() - now;
                timeline.play();
                lastTimerCall = now + delta;
            }
        }
    };

    registerListener();
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:40,代码来源:RadarChartTest.java

示例5: getColorFromDef

import javafx.scene.paint.Color; //导入方法依赖的package包/类
/**
 * Instantiate a {@link Color} from a {@link ColorDefinition} object.
 *
 * @param colorDef
 *            The ColorDefinition
 * @return The Color object
 */
public static synchronized Color getColorFromDef(ColorDefinition colorDef) {
    Color color = COLOR_MAP.get(colorDef);
    if (color == null) {
        color = Color.rgb(colorDef.getRed(), colorDef.getGreen(), colorDef.getBlue(), (double) colorDef.getAlpha() / (double) ColorDefinition.MAX);
        COLOR_MAP.put(colorDef, color);
    }
    return color;
}
 
开发者ID:lttng,项目名称:lttng-scope,代码行数:16,代码来源:JfxColorFactory.java

示例6: createRandomValue

import javafx.scene.paint.Color; //导入方法依赖的package包/类
private Object createRandomValue(AnimatableField field) {
    if (random.nextInt(10) == 0) {
        return null;
    } else if (field == AnimatableField.STROKE || field == AnimatableField.FILL) {
        return Color.rgb(random.nextInt(255), random.nextInt(255), random.nextInt(255));
    } else {
        return random.nextDouble();
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:10,代码来源:EventTest.java

示例7: getMaxCount

import javafx.scene.paint.Color; //导入方法依赖的package包/类
public static Color getMaxCount(List<String> s) {
    List<String> list = s;
    Map<String, Integer> map = new HashMap<String, Integer>();
    for (String c : list) {
        Integer l = map.get(c);
        if (l == null)
            l = 1;
        else
            l++;
        map.put(c, l);
    }
    String max = null;
    long num = 0;
    for (Map.Entry<String, Integer> entry : map.entrySet()) {
        String key = entry.getKey();
        Integer temp = entry.getValue();
        if (max == null || temp > num) {
            max = key;
            num = temp;
        }
    }
    String str[] = max.split("\\-");
    if (str.length == 3) {
        return Color.rgb(Integer.parseInt(str[0]), Integer.parseInt(str[1]),
                Integer.parseInt(str[2]));
    }
    return Color.WHITE;
}
 
开发者ID:IzzelAliz,项目名称:LCL,代码行数:29,代码来源:GetMainColor.java

示例8: changed

import javafx.scene.paint.Color; //导入方法依赖的package包/类
@Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) {
	double red = slider1.getValue();
	double green = slider2.getValue();
	double blue = slider3.getValue();
	Color color = Color.rgb((int)red,(int)green,(int)blue);
	pane.setBackground(new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)));
}
 
开发者ID:naeemkhan12,项目名称:JavaFx-Material-Design,代码行数:9,代码来源:Controller.java

示例9: createIconContent

import javafx.scene.paint.Color; //导入方法依赖的package包/类
public static Node createIconContent() {
    Rectangle rect = new Rectangle(80,80,new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.rgb(156,216,255)),
        new Stop(0.5, Color.DODGERBLUE),
        new Stop(1, Color.rgb(0,70,140))
    }));
    rect.setArcWidth(20);
    rect.setArcHeight(20);
    return rect;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:11,代码来源:LinearGradientSample.java

示例10: initInfoPanel

import javafx.scene.paint.Color; //导入方法依赖的package包/类
private void initInfoPanel() {
    infoPanel = new Group();
    roundCaption = new Text();
    roundCaption.setText("ROUND");
    roundCaption.setTextOrigin(VPos.TOP);
    roundCaption.setFill(Color.rgb(51, 102, 51));
    Font f = new Font("Impact", 18);
    roundCaption.setFont(f);
    roundCaption.setTranslateX(30);
    roundCaption.setTranslateY(128);
    round = new Text();
    round.setTranslateX(roundCaption.getTranslateX() +
        roundCaption.getBoundsInLocal().getWidth() + Config.INFO_TEXT_SPACE);
    round.setTranslateY(roundCaption.getTranslateY());
    round.setText(levelNumber + "");
    round.setTextOrigin(VPos.TOP);
    round.setFont(f);
    round.setFill(Color.rgb(0, 204, 102));
    scoreCaption = new Text();
    scoreCaption.setText("SCORE");
    scoreCaption.setFill(Color.rgb(51, 102, 51));
    scoreCaption.setTranslateX(30);
    scoreCaption.setTranslateY(164);
    scoreCaption.setTextOrigin(VPos.TOP);
    scoreCaption.setFont(f);
    score = new Text();
    score.setTranslateX(scoreCaption.getTranslateX() +
        scoreCaption.getBoundsInLocal().getWidth() + Config.INFO_TEXT_SPACE);
    score.setTranslateY(scoreCaption.getTranslateY());
    score.setFill(Color.rgb(0, 204, 102));
    score.setTextOrigin(VPos.TOP);
    score.setFont(f);
    score.setText("");
    livesCaption = new Text();
    livesCaption.setText("LIFE");
    livesCaption.setTranslateX(30);
    livesCaption.setTranslateY(200);
    livesCaption.setFill(Color.rgb(51, 102, 51));
    livesCaption.setTextOrigin(VPos.TOP);
    livesCaption.setFont(f);
    Color INFO_LEGEND_COLOR = Color.rgb(0, 114, 188);
    int infoWidth = Config.SCREEN_WIDTH - Config.FIELD_WIDTH;
    Rectangle black = new Rectangle();
    black.setWidth(infoWidth);
    black.setHeight(Config.SCREEN_HEIGHT);
    black.setFill(Color.BLACK);
    ImageView verLine = new ImageView();
    verLine.setImage(new Image(Level.class.getResourceAsStream(Config.IMAGE_DIR+"vline.png")));
    verLine.setTranslateX(3);
    ImageView logo = new ImageView();
    logo.setImage(Config.getImages().get(Config.IMAGE_LOGO));
    logo.setTranslateX(30);
    logo.setTranslateY(30);
    Text legend = new Text();
    legend.setTranslateX(30);
    legend.setTranslateY(310);
    legend.setText("LEGEND");
    legend.setFill(INFO_LEGEND_COLOR);
    legend.setTextOrigin(VPos.TOP);
    legend.setFont(new Font("Impact", 18));
    infoPanel.getChildren().addAll(black, verLine, logo, roundCaption,
            round, scoreCaption, score, livesCaption, legend);
    for (int i = 0; i < Bonus.COUNT; i++) {
        Bonus bonus = new Bonus(i);
        Text text = new Text();
        text.setTranslateX(100);
        text.setTranslateY(350 + i * 40);
        text.setText(Bonus.NAMES[i]);
        text.setFill(INFO_LEGEND_COLOR);
        text.setTextOrigin(VPos.TOP);
        text.setFont(new Font("Arial", 12));
        bonus.setTranslateX(30 + (820 - 750 - bonus.getWidth()) / 2);
        bonus.setTranslateY(text.getTranslateY() -
            (bonus.getHeight() - text.getBoundsInLocal().getHeight()) / 2);
        // Workaround JFXC-2379
        infoPanel.getChildren().addAll(bonus, text);
    }
    infoPanel.setTranslateX(Config.FIELD_WIDTH);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:80,代码来源:Level.java

示例11: randomColor

import javafx.scene.paint.Color; //导入方法依赖的package包/类
private static Color randomColor() {
    int red = (int) (170D + 75D * SimplexNoise.noise(((double) r++) / 5D, 0));
    int green = (int) (165D + 70D * SimplexNoise.noise(((double) g++) / 5D, 0));
    int blue = (int) (160D + 65D * SimplexNoise.noise(((double) b++) / 5D, 0));
    return Color.rgb(red, green, blue);
}
 
开发者ID:IzzelAliz,项目名称:LCL,代码行数:7,代码来源:Transition.java

示例12: ChartData

import javafx.scene.paint.Color; //导入方法依赖的package包/类
public ChartData() {
    this("", 0, Color.rgb(233, 30, 99), Color.TRANSPARENT, Color.BLACK, Instant.now(), true, 800);
}
 
开发者ID:HanSolo,项目名称:SunburstChart,代码行数:4,代码来源:ChartData.java

示例13: DotMatrix

import javafx.scene.paint.Color; //导入方法依赖的package包/类
public DotMatrix(final int COLS, final int ROWS) {
    this(250, 250, COLS, ROWS, Color.rgb(255, 55, 0), Color.rgb(51, 51, 51, 0.5), DotShape.SQUARE, MatrixFont8x8.INSTANCE);
}
 
开发者ID:HanSolo,项目名称:dotmatrix,代码行数:4,代码来源:DotMatrix.java

示例14: ChartData

import javafx.scene.paint.Color; //导入方法依赖的package包/类
public ChartData() {
    this("", 0, Color.rgb(0, 80, 200));
}
 
开发者ID:HanSolo,项目名称:radialchart,代码行数:4,代码来源:ChartData.java

示例15: getColor

import javafx.scene.paint.Color; //导入方法依赖的package包/类
/**
 * returns an color, where the h value in HSB is between 0 and 230 degree in depentend of the value parameter.
 */
private Color getColor(double value, MeshCalculationComposite calculationObject) {
    java.awt.Color hsb = java.awt.Color.getHSBColor((float) (value / calculationObject.getSize() * (23.0 / 36.0)), 1.0f, 1.0f);
    return Color.rgb(hsb.getRed(), hsb.getGreen(), hsb.getBlue());
}
 
开发者ID:adihubba,项目名称:javafx-3d-surface-chart,代码行数:8,代码来源:MeshImageBuilder.java


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