private void createLetter(String c) {
final Text letter = new Text(c);
letter.setFill(Color.BLACK);
letter.setFont(FONT_DEFAULT);
letter.setTextOrigin(VPos.TOP);
letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2);
letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2);
getChildren().add(letter);
// over 3 seconds move letter to random position and fade it out
final Timeline timeline = new Timeline();
timeline.getKeyFrames().add(
new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent event) {
// we are done remove us from scene
getChildren().remove(letter);
}
},
new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR),
new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR),
new KeyValue(letter.opacityProperty(), 0f)
));
timeline.play();
}
java类javafx.geometry.VPos的实例源码
KeyStrokeMotion.java 文件源码
项目:incubator-netbeans
阅读 34
收藏 0
点赞 0
评论 0
KeyStrokeMotion.java 文件源码
项目:marathonv5
阅读 29
收藏 0
点赞 0
评论 0
private void createLetter(String c) {
final Text letter = new Text(c);
letter.setFill(Color.BLACK);
letter.setFont(FONT_DEFAULT);
letter.setTextOrigin(VPos.TOP);
letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2);
letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2);
getChildren().add(letter);
// over 3 seconds move letter to random position and fade it out
final Timeline timeline = new Timeline();
timeline.getKeyFrames().add(
new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent event) {
// we are done remove us from scene
getChildren().remove(letter);
}
},
new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR),
new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR),
new KeyValue(letter.opacityProperty(), 0f)
));
timeline.play();
}
KeyStrokeMotion.java 文件源码
项目:marathonv5
阅读 30
收藏 0
点赞 0
评论 0
private void createLetter(String c) {
final Text letter = new Text(c);
letter.setFill(Color.BLACK);
letter.setFont(FONT_DEFAULT);
letter.setTextOrigin(VPos.TOP);
letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2);
letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2);
getChildren().add(letter);
// over 3 seconds move letter to random position and fade it out
final Timeline timeline = new Timeline();
timeline.getKeyFrames().add(
new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent event) {
// we are done remove us from scene
getChildren().remove(letter);
}
},
new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR),
new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR),
new KeyValue(letter.opacityProperty(), 0f)
));
timeline.play();
}
StopWatch.java 文件源码
项目:incubator-netbeans
阅读 26
收藏 0
点赞 0
评论 0
private void configureDigits() {
for (int i : numbers) {
digits[i] = new Text("0");
digits[i].setFont(FONT);
digits[i].setTextOrigin(VPos.TOP);
digits[i].setLayoutX(2.3);
digits[i].setLayoutY(-1);
Rectangle background;
if (i < 6) {
background = createBackground(Color.web("#a39f91"), Color.web("#FFFFFF"));
digits[i].setFill(Color.web("#000000"));
} else {
background = createBackground(Color.web("#bdbeb3"), Color.web("#FF0000"));
digits[i].setFill(Color.web("#FFFFFF"));
}
digitsGroup[i] = new Group(background, digits[i]);
}
}
Sample.java 文件源码
项目:marathonv5
阅读 31
收藏 0
点赞 0
评论 0
@Override protected void layoutChildren() {
if (isFixedSize) {
super.layoutChildren();
} else {
List<Node> managed = getManagedChildren();
double width = getWidth();
///System.out.println("width = " + width);
double height = getHeight();
///System.out.println("height = " + height);
double top = getInsets().getTop();
double right = getInsets().getRight();
double left = getInsets().getLeft();
double bottom = getInsets().getBottom();
for (int i = 0; i < managed.size(); i++) {
Node child = managed.get(i);
layoutInArea(child, left, top,
width - left - right, height - top - bottom,
0, Insets.EMPTY, true, true, HPos.CENTER, VPos.CENTER);
}
}
}
HTMLEditorSample.java 文件源码
项目:marathonv5
阅读 24
收藏 0
点赞 0
评论 0
public static Node createIconContent() {
Text htmlStart = new Text("<html>");
Text htmlEnd = new Text("</html>");
htmlStart.setFont(Font.font(null, FontWeight.BOLD, 20));
htmlStart.setStyle("-fx-font-size: 20px;");
htmlStart.setTextOrigin(VPos.TOP);
htmlStart.setLayoutY(11);
htmlStart.setLayoutX(20);
htmlEnd.setFont(Font.font(null, FontWeight.BOLD, 20));
htmlEnd.setStyle("-fx-font-size: 20px;");
htmlEnd.setTextOrigin(VPos.TOP);
htmlEnd.setLayoutY(31);
htmlEnd.setLayoutX(20);
return new Group(htmlStart, htmlEnd);
}
StopWatchSample.java 文件源码
项目:marathonv5
阅读 24
收藏 0
点赞 0
评论 0
private void configureDigits() {
for (int i : numbers) {
digits[i] = new Text("0");
digits[i].setFont(FONT);
digits[i].setTextOrigin(VPos.TOP);
digits[i].setLayoutX(2.3);
digits[i].setLayoutY(-1);
Rectangle background;
if (i < 6) {
background = createBackground(Color.web("#a39f91"), Color.web("#FFFFFF"));
digits[i].setFill(Color.web("#000000"));
} else {
background = createBackground(Color.web("#bdbeb3"), Color.web("#FF0000"));
digits[i].setFill(Color.web("#FFFFFF"));
}
digitsGroup[i] = new Group(background, digits[i]);
}
}
StringBindingSample.java 文件源码
项目:marathonv5
阅读 25
收藏 0
点赞 0
评论 0
public static Node createIconContent() {
Text text = new Text("abc");
text.setTextOrigin(VPos.TOP);
text.setLayoutX(10);
text.setLayoutY(11);
text.setFill(Color.BLACK);
text.setOpacity(0.5);
text.setFont(Font.font(null, FontWeight.BOLD, 20));
text.setStyle("-fx-font-size: 20px;");
Text text2 = new Text("abc");
text2.setTextOrigin(VPos.TOP);
text2.setLayoutX(28);
text2.setLayoutY(51);
text2.setFill(Color.BLACK);
text2.setFont(javafx.scene.text.Font.font(null, FontWeight.BOLD, 20));
text2.setStyle("-fx-font-size: 20px;");
Line line = new Line(30, 32, 45, 57);
line.setStroke(Color.DARKMAGENTA);
return new javafx.scene.Group(text, line, text2);
}
FormPane.java 文件源码
项目:marathonv5
阅读 30
收藏 0
点赞 0
评论 0
public FormPane addFormField(String text, Node... fields) {
Label label = new Label(text);
String labelId = idText(text);
label.setId(labelId);
GridPane.setValignment(label, VPos.TOP);
int column = 0;
add(label, column++, currentRow, 1, 1);
int colspan = columns - fields.length;
int fieldIndex = 1;
for (Node field : fields) {
field.setId(labelId + "-field-" + fieldIndex);
setFormConstraints(field);
GridPane.setValignment(field, VPos.TOP);
add(field, column++, currentRow, colspan, 1);
fieldIndex++;
}
currentRow++;
column = 0;
return this;
}
Sample.java 文件源码
项目:marathonv5
阅读 26
收藏 0
点赞 0
评论 0
@Override protected void layoutChildren() {
if (isFixedSize) {
super.layoutChildren();
} else {
List<Node> managed = getManagedChildren();
double width = getWidth();
///System.out.println("width = " + width);
double height = getHeight();
///System.out.println("height = " + height);
double top = getInsets().getTop();
double right = getInsets().getRight();
double left = getInsets().getLeft();
double bottom = getInsets().getBottom();
for (int i = 0; i < managed.size(); i++) {
Node child = managed.get(i);
layoutInArea(child, left, top,
width - left - right, height - top - bottom,
0, Insets.EMPTY, true, true, HPos.CENTER, VPos.CENTER);
}
}
}
HTMLEditorSample.java 文件源码
项目:marathonv5
阅读 36
收藏 0
点赞 0
评论 0
public static Node createIconContent() {
Text htmlStart = new Text("<html>");
Text htmlEnd = new Text("</html>");
htmlStart.setFont(Font.font(null, FontWeight.BOLD, 20));
htmlStart.setStyle("-fx-font-size: 20px;");
htmlStart.setTextOrigin(VPos.TOP);
htmlStart.setLayoutY(11);
htmlStart.setLayoutX(20);
htmlEnd.setFont(Font.font(null, FontWeight.BOLD, 20));
htmlEnd.setStyle("-fx-font-size: 20px;");
htmlEnd.setTextOrigin(VPos.TOP);
htmlEnd.setLayoutY(31);
htmlEnd.setLayoutX(20);
return new Group(htmlStart, htmlEnd);
}
StopWatchSample.java 文件源码
项目:marathonv5
阅读 25
收藏 0
点赞 0
评论 0
private void configureDigits() {
for (int i : numbers) {
digits[i] = new Text("0");
digits[i].setFont(FONT);
digits[i].setTextOrigin(VPos.TOP);
digits[i].setLayoutX(2.3);
digits[i].setLayoutY(-1);
Rectangle background;
if (i < 6) {
background = createBackground(Color.web("#a39f91"), Color.web("#FFFFFF"));
digits[i].setFill(Color.web("#000000"));
} else {
background = createBackground(Color.web("#bdbeb3"), Color.web("#FF0000"));
digits[i].setFill(Color.web("#FFFFFF"));
}
digitsGroup[i] = new Group(background, digits[i]);
}
}
StringBindingSample.java 文件源码
项目:marathonv5
阅读 21
收藏 0
点赞 0
评论 0
public static Node createIconContent() {
Text text = new Text("abc");
text.setTextOrigin(VPos.TOP);
text.setLayoutX(10);
text.setLayoutY(11);
text.setFill(Color.BLACK);
text.setOpacity(0.5);
text.setFont(Font.font(null, FontWeight.BOLD, 20));
text.setStyle("-fx-font-size: 20px;");
Text text2 = new Text("abc");
text2.setTextOrigin(VPos.TOP);
text2.setLayoutX(28);
text2.setLayoutY(51);
text2.setFill(Color.BLACK);
text2.setFont(javafx.scene.text.Font.font(null, FontWeight.BOLD, 20));
text2.setStyle("-fx-font-size: 20px;");
Line line = new Line(30, 32, 45, 57);
line.setStroke(Color.DARKMAGENTA);
return new javafx.scene.Group(text, line, text2);
}
TransformerSkin.java 文件源码
项目:dynamo
阅读 30
收藏 0
点赞 0
评论 0
private void resize() {
width = getSkinnable().getWidth();
height = getSkinnable().getHeight();
if (width > 0 && height > 0) {
size = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight();
background.setPrefSize(width, height);
transformer.setPrefSize(width, height);
name.setText(getSkinnable().getName());
name.setFont(Font.font(size*NAME_TEXT_SIZE_FACTOR));
name.setX((size - name.getLayoutBounds().getWidth()) * 0.5);
name.setY((size - name.getLayoutBounds().getHeight()) * 0.5);
name.setTextOrigin(VPos.TOP);
updateState();
}
}
DisplaySkin.java 文件源码
项目:dynamo
阅读 23
收藏 0
点赞 0
评论 0
private void resize() {
width = getSkinnable().getWidth();
height = getSkinnable().getHeight();
size = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight();
if (width > 0 && height > 0) {
updateFonts(); // Set fonts size
warningIcon.setPrefSize(width*0.12, height*0.3);
titleText.setTextOrigin(VPos.TOP);
titleText.setTextAlignment(TextAlignment.CENTER);
titleText.setText(getSkinnable().getTitle());
titleText.setX((width - titleText.getLayoutBounds().getWidth()) * 0.5); // In the middle
background.setPrefSize(width, (height -(titleText.getLayoutBounds().getHeight())));
background.setTranslateY((height - (height - titleText.getLayoutBounds().getHeight()))); // Under the titleText
frame.setPrefSize(width, titleText.getLayoutBounds().getHeight());
frame.setTranslateY(height - (height - titleText.getLayoutBounds().getHeight())); // With background
updateDisplay(); // Inside the frame
}
}
LoadSkin.java 文件源码
项目:dynamo
阅读 34
收藏 0
点赞 0
评论 0
private void resize() {
width = getSkinnable().getWidth();
height = getSkinnable().getHeight();
if (width > 0 && height > 0) {
size = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight();
background.setPrefSize(width, height);
load.setPrefSize(width, height);
name.setText(getSkinnable().getName());
name.setFont(Font.font(size*NAME_TEXT_SIZE_FACTOR));
name.setX((size - name.getLayoutBounds().getWidth()) * 0.5);
name.setY((size - name.getLayoutBounds().getHeight()) * 0.5);
name.setTextOrigin(VPos.TOP);
updateState();
}
}
LevelBarSkin.java 文件源码
项目:dynamo
阅读 24
收藏 0
点赞 0
评论 0
private void updatePointer() {
currentValueText.setText(formatCurrentValue(getSkinnable().getCurrentValue(), getSkinnable().getDecimals()));
currentValueText.setFont(Font.font("Digital-7", width * CURRENT_VALUE_FONT_SIZE_FACTOR));
currentValueText.setTextOrigin(VPos.TOP);
currentValueText.setTextAlignment(TextAlignment.RIGHT);
currentValuePointer.getStyleClass().clear();
currentValuePointer.getStyleClass().setAll("normal-current-value-pointer");
currentValuePointer.setPrefSize(currentValueText.getLayoutBounds().getWidth()*1.10, currentValueText.getLayoutBounds().getHeight()*1.10);
currentValuePointerGroup.setTranslateX((width/2 + barWidth/2) - currentValuePointerGroup.getLayoutBounds().getWidth());
final double newPosition = getSkinnable().getCurrentValue() < getSkinnable().getMinValue() ? height - (currentValuePointerGroup.getLayoutBounds().getHeight() * 0.5) :
getSkinnable().getCurrentValue() > getSkinnable().getMaxValue() ? height - barHeight - (currentValuePointerGroup.getLayoutBounds().getHeight() * 0.5) :
height - (currentValuePointerGroup.getLayoutBounds().getHeight() * 0.5) - (barHeight * (getSkinnable().getCurrentValue()-getSkinnable().getMinValue()) / (getSkinnable().getMaxValue()-getSkinnable().getMinValue()));
if(getSkinnable().getAnimated()){
timeline.stop();
final KeyValue KEY_VALUE = new KeyValue(currentValuePointerGroup.translateYProperty(), newPosition, Interpolator.EASE_BOTH);
final KeyFrame KEY_FRAME = new KeyFrame(Duration.millis(getSkinnable().getAnimationDuration()), KEY_VALUE);
timeline.getKeyFrames().setAll(KEY_FRAME);
timeline.play();
}else {
currentValuePointerGroup.setTranslateY(newPosition);
}
}
NotificationPane.java 文件源码
项目:WeatherWatch
阅读 33
收藏 0
点赞 0
评论 0
private void setupView() {
ImageView weatherIcon = new ImageView();
weatherIcon.setImage(weatherEvent.getForecast().getWeather().getIcon());
weatherIcon.fitWidthProperty().bind(stage.widthProperty().divide(3));
weatherIcon.fitHeightProperty().bind(stage.heightProperty().multiply(1));
GridPane.setHgrow(weatherIcon, Priority.ALWAYS);
GridPane.setVgrow(weatherIcon, Priority.ALWAYS);
GridPane.setHalignment(weatherIcon, HPos.CENTER);
GridPane.setValignment(weatherIcon, VPos.CENTER);
add(weatherIcon, 0, 0);
Text txt_weather_event = new Text();
txt_weather_event.setText(controller.getWeatherEventText());
GridPane.setHgrow(txt_weather_event, Priority.ALWAYS);
GridPane.setVgrow(txt_weather_event, Priority.ALWAYS);
GridPane.setValignment(txt_weather_event, VPos.CENTER);
add(txt_weather_event, 1, 0);
}
FormDialog.java 文件源码
项目:redisfx
阅读 25
收藏 0
点赞 0
评论 0
private GridPane getContentPane() {
contentPane.setHgap(10);
contentPane.setVgap(10);
// top-align all child nodes
contentPane.getChildren().addListener((ListChangeListener<Node>) c -> {
while (c.next()) {
if (c.wasAdded()) {
c.getAddedSubList().forEach(node ->
GridPane.setValignment(node, VPos.TOP));
}
}
});
ColumnConstraints titleCC = new ColumnConstraints();
titleCC.setPrefWidth(100);
ColumnConstraints valueCC = new ColumnConstraints();
valueCC.setFillWidth(true);
valueCC.setHgrow(Priority.ALWAYS);
contentPane.getColumnConstraints().addAll(titleCC, valueCC);
VBox.setVgrow(contentPane, Priority.ALWAYS);
return contentPane;
}
SankeyPlot.java 文件源码
项目:sankeyplot
阅读 25
收藏 0
点赞 0
评论 0
private void resize() {
width = getWidth() - getInsets().getLeft() - getInsets().getRight();
height = getHeight() - getInsets().getTop() - getInsets().getBottom();
size = width < height ? width : height;
if (width > 0 && height > 0) {
canvas.setWidth(width);
canvas.setHeight(height);
canvas.relocate((getWidth() - width) * 0.5, (getHeight() - height) * 0.5);
ctx.setTextBaseline(VPos.CENTER);
ctx.setFont(Font.font(Helper.clamp(8, 24, size * 0.025)));
prepareData();
}
}
CoxcombChart.java 文件源码
项目:charts
阅读 26
收藏 0
点赞 0
评论 0
private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight());
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
getStyleClass().add("coxcomb-chart");
popup = new InfoPopup();
canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
ctx = canvas.getGraphicsContext2D();
ctx.setLineCap(StrokeLineCap.BUTT);
ctx.setTextBaseline(VPos.CENTER);
ctx.setTextAlign(TextAlignment.CENTER);
pane = new Pane(canvas);
getChildren().setAll(pane);
}
LegendItem.java 文件源码
项目:charts
阅读 28
收藏 0
点赞 0
评论 0
private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight());
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
canvas = new Canvas(PREFERRED_HEIGHT, PREFERRED_HEIGHT);
ctx = canvas.getGraphicsContext2D();
ctx.setTextAlign(TextAlignment.LEFT);
ctx.setTextBaseline(VPos.CENTER);
pane = new Pane(canvas);
getChildren().setAll(pane);
}
SankeyPlot.java 文件源码
项目:charts
阅读 28
收藏 0
点赞 0
评论 0
private void resize() {
width = getWidth() - getInsets().getLeft() - getInsets().getRight();
height = getHeight() - getInsets().getTop() - getInsets().getBottom();
size = width < height ? width : height;
if (width > 0 && height > 0) {
canvas.setWidth(width);
canvas.setHeight(height);
canvas.relocate((getWidth() - width) * 0.5, (getHeight() - height) * 0.5);
ctx.setTextBaseline(VPos.CENTER);
ctx.setFont(Font.font(Helper.clamp(8, 24, size * 0.025)));
prepareData();
}
}
AreaHeatMap.java 文件源码
项目:charts
阅读 32
收藏 0
点赞 0
评论 0
private void drawDataPoints() {
ctx.setTextAlign(TextAlignment.CENTER);
ctx.setTextBaseline(VPos.CENTER);
ctx.setFont(Font.font(size * 0.0175));
for (int i = 0 ; i < points.size() ; i++) {
DataPoint point = points.get(i);
ctx.setFill(Color.rgb(255, 255, 255, 0.5));
ctx.fillOval(point.getX() - 8, point.getY() - 8, 16, 16);
//ctx.setStroke(getUseColorMapping() ? getColorForValue(point.getValue(), 1) : getColorForValue(point.getValue(), isDiscreteColors()));
ctx.setStroke(Color.BLACK);
ctx.strokeOval(point.getX() - 8, point.getY() - 8, 16, 16);
ctx.setFill(Color.BLACK);
ctx.fillText(Long.toString(Math.round(point.getValue())), point.getX(), point.getY(), 16);
}
}
StreamChart.java 文件源码
项目:charts
阅读 28
收藏 0
点赞 0
评论 0
private void resize() {
width = getWidth() - getInsets().getLeft() - getInsets().getRight();
height = getHeight() - getInsets().getTop() - getInsets().getBottom();
reducedHeight = height - height * 0.05;
size = width < height ? width : height;
if (width > 0 && height > 0) {
canvas.setWidth(width);
canvas.setHeight(height);
canvas.relocate((getWidth() - width) * 0.5, (getHeight() - height) * 0.5);
ctx.setTextBaseline(VPos.CENTER);
ctx.setFont(Font.font(Helper.clamp(8, 24, size * 0.025)));
groupBy(getCategory());
}
}
GaugeTileSkin.java 文件源码
项目:tilesfx
阅读 21
收藏 0
点赞 0
评论 0
@Override protected void resizeDynamicText() {
double maxWidth = unitText.isManaged() ? width - size * 0.275 : width - size * 0.1;
double fontSize = size * 0.24;
valueText.setFont(Fonts.latoRegular(fontSize));
if (valueText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(valueText, maxWidth, fontSize); }
fontSize = size * 0.1;
unitText.setFont(Fonts.latoRegular(fontSize));
if (unitText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(unitText, maxWidth, fontSize); }
thresholdText.setFill(sectionsVisible ? Color.TRANSPARENT : tile.getBackgroundColor());
if (!sectionsVisible) {
fontSize = size * 0.08;
thresholdText.setFont(Fonts.latoRegular(fontSize));
thresholdText.setTextOrigin(VPos.CENTER);
if (thresholdText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(thresholdText, maxWidth, fontSize); }
thresholdText.setX((width - thresholdText.getLayoutBounds().getWidth()) * 0.5);
thresholdText.setY(thresholdRect.getLayoutBounds().getMinY() + thresholdRect.getHeight() * 0.5);
}
}
JrdsAdapterDialog.java 文件源码
项目:binjr
阅读 21
收藏 0
点赞 0
评论 0
/**
* Initializes a new instance of the {@link JrdsAdapterDialog} class.
*
* @param owner the owner window for the dialog
*/
public JrdsAdapterDialog(Node owner) {
super(owner, Mode.URL);
this.parent.setHeaderText("Connect to a JRDS source");
this.tabsChoiceBox = new ChoiceBox<>();
tabsChoiceBox.getItems().addAll(JrdsTreeViewTab.values());
this.extraArgumentTextField = new TextField();
HBox.setHgrow(extraArgumentTextField, Priority.ALWAYS);
HBox hBox = new HBox(tabsChoiceBox, extraArgumentTextField);
hBox.setSpacing(10);
GridPane.setConstraints(hBox, 1, 2, 1, 1, HPos.LEFT, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS, new Insets(4, 0, 4, 0));
tabsChoiceBox.getSelectionModel().select(JrdsTreeViewTab.HOSTS_TAB);
Label tabsLabel = new Label("Sorted By:");
GridPane.setConstraints(tabsLabel, 0, 2, 1, 1, HPos.LEFT, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS, new Insets(4, 0, 4, 0));
this.paramsGridPane.getChildren().addAll(tabsLabel, hBox);
extraArgumentTextField.visibleProperty().bind(Bindings.createBooleanBinding(() -> this.tabsChoiceBox.valueProperty().get().getArgument() != null, this.tabsChoiceBox.valueProperty()));
}
BarChartItem.java 文件源码
项目:tilesfx
阅读 28
收藏 0
点赞 0
评论 0
private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 ||
Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight());
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
nameText = new Text(getName());
nameText.setTextOrigin(VPos.TOP);
valueText = new Text(String.format(locale, formatString, getValue()));
valueText.setTextOrigin(VPos.TOP);
barBackground = new Rectangle();
bar = new Rectangle();
pane = new Pane(nameText, valueText, barBackground, bar);
pane.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
getChildren().setAll(pane);
}
DonutChartTileSkin.java 文件源码
项目:tilesfx
阅读 25
收藏 0
点赞 0
评论 0
private void drawLegend() {
List<ChartData> dataList = tile.getChartData();
double canvasWidth = legendCanvas.getWidth();
double canvasHeight = legendCanvas.getHeight();
int noOfItems = dataList.size();
//List<ChartData> sortedDataList = dataList.stream().sorted(Comparator.comparingDouble(ChartData::getValue).reversed()).collect(Collectors.toList());
Color textColor = tile.getTextColor();
double stepSize = canvasHeight * 0.9 / (noOfItems + 1);
legendCtx.clearRect(0, 0, canvasWidth, canvasHeight);
legendCtx.setTextAlign(TextAlignment.LEFT);
legendCtx.setTextBaseline(VPos.CENTER);
legendCtx.setFont(Fonts.latoRegular(canvasHeight * 0.05));
for (int i = 0 ; i < noOfItems ; i++) {
ChartData data = dataList.get(i);
legendCtx.setFill(data.getFillColor());
legendCtx.fillOval(0, (i + 1) * stepSize, size * 0.0375, size * 0.0375);
legendCtx.setFill(textColor);
legendCtx.fillText(data.getName(), size * 0.05, (i + 1) * stepSize + canvasHeight * 0.025);
}
}
global.java 文件源码
项目:sudoku-desktop-game
阅读 28
收藏 0
点赞 0
评论 0
/**
* Initialize button styles, icons sizes Muhammad Tarek
*
* @param button
* @param layout
* @param position
* @param icon
*/
static void initButtonStyle(Button button, GridPane layout, int position, ImageView icon, int bgColor) {
button.getStyleClass().add("icon-text-button");
if (icon != null) {
icon.setFitHeight(bgColor == 1 ? 20 : 24);
icon.setFitWidth(bgColor == 1 ? 20 : 24);
}
button.getStyleClass().add("button-icon_text");
button.setAlignment(Pos.CENTER_LEFT);
if (bgColor == 1) {
button.getStyleClass().add("button-icon_text--transparent");
} else {
button.getStyleClass().add("button-icon_text--white");
}
layout.setConstraints(button, 0, position);
layout.setHalignment(button, HPos.CENTER);
layout.setValignment(button, VPos.CENTER);
layout.getChildren().add(button);
}