本文整理汇总了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);
}
示例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;
}
示例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;
}
}
示例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();
}
示例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;
}
示例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();
}
}
示例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;
}
示例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)));
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例14: ChartData
import javafx.scene.paint.Color; //导入方法依赖的package包/类
public ChartData() {
this("", 0, Color.rgb(0, 80, 200));
}
示例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());
}