當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。