下面列出了javafx.scene.control.Label#setLayoutY ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void start(Stage stage) {
Pane root = new Pane();
for(int i = 0 ;i < 4000; i++) {
Label child = new Label("label" + i);
child.setLayoutX(Math.random() * 500 + 100);
child.setLayoutY(Math.random() * 500+ 100);
root.getChildren().add(child);
}
root.getChildren().add(build());
FPSDecorator decorator = new FPSDecorator(stage, root);
final Scene scene = new Scene(decorator, 800, 800);
stage.setScene(scene);
stage.setResizable(true);
stage.show();
afterShow(stage);
}
public TxIdTextField() {
txConfidenceIndicator = new TxConfidenceIndicator();
txConfidenceIndicator.setFocusTraversable(false);
txConfidenceIndicator.setMaxSize(20, 20);
txConfidenceIndicator.setId("funds-confidence");
txConfidenceIndicator.setLayoutY(1);
txConfidenceIndicator.setProgress(0);
txConfidenceIndicator.setVisible(false);
AnchorPane.setRightAnchor(txConfidenceIndicator, 0.0);
AnchorPane.setTopAnchor(txConfidenceIndicator, 3.0);
progressIndicatorTooltip = new Tooltip("-");
txConfidenceIndicator.setTooltip(progressIndicatorTooltip);
copyIcon = new Label();
copyIcon.setLayoutY(3);
copyIcon.getStyleClass().addAll("icon", "highlight");
copyIcon.setTooltip(new Tooltip(Res.get("txIdTextField.copyIcon.tooltip")));
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
AnchorPane.setRightAnchor(copyIcon, 30.0);
Tooltip tooltip = new Tooltip(Res.get("txIdTextField.blockExplorerIcon.tooltip"));
blockExplorerIcon = new Label();
blockExplorerIcon.getStyleClass().addAll("icon", "highlight");
blockExplorerIcon.setTooltip(tooltip);
AwesomeDude.setIcon(blockExplorerIcon, AwesomeIcon.EXTERNAL_LINK);
blockExplorerIcon.setMinWidth(20);
AnchorPane.setRightAnchor(blockExplorerIcon, 52.0);
AnchorPane.setTopAnchor(blockExplorerIcon, 4.0);
textField = new JFXTextField();
textField.setId("address-text-field");
textField.setEditable(false);
textField.setTooltip(tooltip);
AnchorPane.setRightAnchor(textField, 80.0);
AnchorPane.setLeftAnchor(textField, 0.0);
textField.focusTraversableProperty().set(focusTraversableProperty().get());
getChildren().addAll(textField, copyIcon, blockExplorerIcon, txConfidenceIndicator);
}
public MyNode(String name) {
text = new Label(name);
text.setStyle("-fx-border-color:black; -fx-padding:3px;");
text.setLayoutX(4);
text.setLayoutY(2);
getChildren().addAll(text);
}
public MyNode(String name) {
text = new Label(name);
text.setStyle("-fx-border-color:black; -fx-padding:3px;");
text.setLayoutX(4);
text.setLayoutY(2);
getChildren().addAll(text);
}
@Override
public void autocalibrationTimedOut() {
calibrated = false;
final Label calibrationLabel = new Label("Calibration Failed!");
calibrationLabel.setFont(Font.font(48));
calibrationLabel.setTextFill(Color.web("#f5a807"));
calibrationLabel.setLayoutX(6);
calibrationLabel.setLayoutY(6);
calibrationLabel.setPrefSize(628, 90);
calibrationLabel.setAlignment(Pos.CENTER);
arenaPane.getCanvasManager().getCanvasGroup().getChildren().add(calibrationLabel);
}
public TextFieldWithIcon() {
textField = new JFXTextField();
textField.setEditable(false);
textField.setMouseTransparent(true);
textField.setFocusTraversable(false);
setLeftAnchor(textField, 0d);
setRightAnchor(textField, 0d);
dummyTextField = new Label();
dummyTextField.setWrapText(true);
dummyTextField.setAlignment(Pos.CENTER_LEFT);
dummyTextField.setTextAlignment(TextAlignment.LEFT);
dummyTextField.setMouseTransparent(true);
dummyTextField.setFocusTraversable(false);
setLeftAnchor(dummyTextField, 0d);
dummyTextField.setVisible(false);
iconLabel = new Label();
iconLabel.setLayoutX(0);
iconLabel.setLayoutY(3);
dummyTextField.widthProperty().addListener((observable, oldValue, newValue) -> {
iconLabel.setLayoutX(dummyTextField.widthProperty().get() + 20);
});
getChildren().addAll(textField, dummyTextField, iconLabel);
}
public FundsTextField() {
super();
textField.textProperty().unbind();
textField.textProperty().bind(Bindings.concat(textProperty(), " ", fundsStructure));
Label copyIcon = getIcon(AwesomeIcon.COPY);
copyIcon.setLayoutY(5);
copyIcon.getStyleClass().addAll("icon", "highlight");
Tooltip.install(copyIcon, new Tooltip(Res.get("shared.copyToClipboard")));
copyIcon.setOnMouseClicked(e -> {
String text = getText();
if (text != null && text.length() > 0) {
String copyText;
String[] strings = text.split(" ");
if (strings.length > 1)
copyText = strings[0]; // exclude the BTC postfix
else
copyText = text;
Utilities.copyToClipboard(copyText);
}
});
AnchorPane.setRightAnchor(copyIcon, 30.0);
AnchorPane.setRightAnchor(infoIcon, 62.0);
AnchorPane.setRightAnchor(textField, 55.0);
getChildren().add(copyIcon);
}
public void setContent(MaterialDesignIcon icon, String info, String style, double opacity) {
hideIcons();
currentIcon = new Label();
Text textIcon = getRegularIconForLabel(icon, currentIcon);
setActionHandlers(new Label(info));
currentIcon.setLayoutY(5);
textIcon.getStyleClass().addAll("icon", style);
currentIcon.setOpacity(opacity);
AnchorPane.setRightAnchor(currentIcon, 7.0);
getChildren().add(currentIcon);
}
public TextFieldWithCopyIcon(String customStyleClass) {
Label copyIcon = new Label();
copyIcon.setLayoutY(3);
copyIcon.getStyleClass().addAll("icon", "highlight");
copyIcon.setTooltip(new Tooltip(Res.get("shared.copyToClipboard")));
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
copyIcon.setOnMouseClicked(e -> {
String text = getText();
if (text != null && text.length() > 0) {
String copyText;
if (copyWithoutCurrencyPostFix) {
String[] strings = text.split(" ");
if (strings.length > 1)
copyText = strings[0]; // exclude the BTC postfix
else
copyText = text;
} else {
copyText = text;
}
Utilities.copyToClipboard(copyText);
}
});
textField = new JFXTextField();
textField.setEditable(false);
if (customStyleClass != null) textField.getStyleClass().add(customStyleClass);
textField.textProperty().bindBidirectional(text);
AnchorPane.setRightAnchor(copyIcon, 5.0);
AnchorPane.setRightAnchor(textField, 30.0);
AnchorPane.setLeftAnchor(textField, 0.0);
textField.focusTraversableProperty().set(focusTraversableProperty().get());
//TODO app wide focus
//focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus());
getChildren().addAll(textField, copyIcon);
}
private void initComponent() {
this.setWidth(520);
this.setHeight(120);
this.setResizable(false);
this.setTitlePaneStyle(2);
this.setRadius(5);
this.setCenter(rootPane);
this.setTitle("服务器地址设置");
titleLabel.setText("服务器地址设置");
titleLabel.setFont(Font.font("微软雅黑", 14));
titleLabel.setStyle("-fx-text-fill:rgba(255, 255, 255, 1)");
topBox.setStyle("-fx-background-color:#2cb1e0");
topBox.setPrefHeight(35);
topBox.setPadding(new Insets(5, 10, 5, 10));
topBox.setSpacing(10);
topBox.getChildren().add(titleLabel);
Label addressLabel = new Label("服务器地址:");
addressField.setPromptText("服务器地址");
addressLabel.setPrefSize(75, 25);
addressLabel.setLayoutX(10);
addressLabel.setLayoutY(5);
addressField.setPrefSize(250, 25);
addressField.setLayoutX(addressLabel.getLayoutX() + addressLabel.getPrefWidth() + 10);
addressField.setLayoutY(addressLabel.getLayoutY());
portField.setPromptText("端口");
Label partLabel = new Label("端口:");
partLabel.setPrefSize(40, 25);
partLabel.setLayoutX(355);
partLabel.setLayoutY(5);
portField.setPrefSize(80, 25);
portField.setLayoutX(partLabel.getLayoutX() + partLabel.getPrefWidth() + 10);
portField.setLayoutY(partLabel.getLayoutY());
AnchorPane infoPane = new AnchorPane();
infoPane.setStyle("-fx-background-color:#ffffff");
infoPane.getChildren().add(addressLabel);
infoPane.getChildren().add(addressField);
infoPane.getChildren().add(partLabel);
infoPane.getChildren().add(portField);
cancelButton.setText("取消");
cancelButton.setPrefWidth(80);
button.setText("确定");
button.setPrefWidth(80);
bottomBox.setStyle("-fx-background-color:#c9e1e9");
bottomBox.setAlignment(Pos.BASELINE_RIGHT);
bottomBox.setPadding(new Insets(5, 10, 5, 10));
bottomBox.setSpacing(10);
bottomBox.getChildren().add(button);
bottomBox.getChildren().add(cancelButton);
rootPane.setTop(topBox);
rootPane.setCenter(infoPane);
rootPane.setBottom(bottomBox);
Pattern pattern = Pattern.compile("0|(-?([1-9]\\d*)?)");
;
TextFormatter<Integer> formatter = new TextFormatter<Integer>(new StringConverter<Integer>() {
@Override
public String toString(Integer value) {
return null != value ? value.toString() : "0";
}
@Override
public Integer fromString(String text) {
int i = 0;
if (null != text) {
Matcher matcher = pattern.matcher(text);
if (matcher.matches()) {
i = Integer.parseInt(text);
}
}
return i;
}
});
portField.setTextFormatter(formatter);
}
private void initComponent() {
this.setStyle("-fx-background-color:#ffffff");
upButton.setText("上一步");
button.setText("确定");
upButton.setPrefSize(80, 25);
button.setPrefSize(80, 25);
Label passwordLabel = new Label("新密码");
Label confirmPasswordLabel = new Label("确认密码");
passwordField.setPromptText("新密码");
confirmPasswordField.setPromptText("确认密码");
passwordLabel.setPrefSize(50, 25);
passwordLabel.setLayoutX(10);
passwordLabel.setLayoutY(15);
passwordField.setPrefSize(290, 25);
passwordField.setLayoutX(passwordLabel.getLayoutX() + passwordLabel.getPrefWidth() + 10);
passwordField.setLayoutY(passwordLabel.getLayoutY());
confirmPasswordLabel.setPrefSize(50, 25);
confirmPasswordLabel.setLayoutX(10);
confirmPasswordLabel.setLayoutY(passwordField.getLayoutY() + passwordField.getPrefHeight() + 15);
confirmPasswordField.setPrefSize(290, 25);
confirmPasswordField.setLayoutX(confirmPasswordLabel.getLayoutX() + confirmPasswordLabel.getPrefWidth() + 10);
confirmPasswordField.setLayoutY(confirmPasswordLabel.getLayoutY());
AnchorPane infoPane = new AnchorPane();
infoPane.getChildren().add(passwordLabel);
infoPane.getChildren().add(confirmPasswordLabel);
infoPane.getChildren().add(passwordField);
infoPane.getChildren().add(confirmPasswordField);
infoPane.setPrefHeight(confirmPasswordField.getLayoutY() + 50);
topVBox.getChildren().add(infoPane);
scrollPane.setBackground(Background.EMPTY);
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setContent(box);
HBox bottomBox = new HBox();
bottomBox.setAlignment(Pos.CENTER);
bottomBox.setPadding(new Insets(5, 10, 5, 10));
bottomBox.setSpacing(10);
bottomBox.getChildren().add(upButton);
bottomBox.getChildren().add(button);
over.setContentNode(overLabel);
baseBorderPane.setTop(topVBox);
baseBorderPane.setCenter(scrollPane);
baseBorderPane.setBottom(bottomBox);
this.getChildren().add(baseBorderPane);
}
private void initComponent() {
this.setTitle("修改资料");
this.setResizable(false);
this.setTitlePaneStyle(2);
this.setWidth(390);
this.setHeight(520);
this.setRadius(5);
this.setCenter(rootPane);
Label nameLabel = new Label("名 \t 称");
Label introduceLabel = new Label("介 \t 绍");
Label publicNoticeLabel = new Label("公 \t 告");
nameField.setPromptText("名称");
introduceTextArea.setPromptText("介 绍");
publicNoticeTextArea.setPromptText("公 告");
imagePanel.setHeadSize(70);
imagePanel.setPrefSize(75, 75);
imagePanel.setLayoutX(70);
imagePanel.setLayoutY(20);
nameLabel.setPrefSize(50, 25);
nameLabel.setLayoutX(10);
nameLabel.setLayoutY(120);
nameField.setPrefSize(290, 25);
nameField.setLayoutX(nameLabel.getLayoutX() + nameLabel.getPrefWidth() + 10);
nameField.setLayoutY(nameLabel.getLayoutY());
introduceLabel.setPrefSize(50, 25);
introduceLabel.setLayoutX(10);
introduceLabel.setLayoutY(nameField.getLayoutY() + nameField.getPrefHeight() + 15);
introduceTextArea.setPrefSize(290, 120);
introduceTextArea.setLayoutX(nameField.getLayoutX());
introduceTextArea.setLayoutY(introduceLabel.getLayoutY());
publicNoticeLabel.setPrefSize(50, 25);
publicNoticeLabel.setLayoutX(10);
publicNoticeLabel.setLayoutY(introduceTextArea.getLayoutY() + introduceTextArea.getPrefHeight() + 15);
publicNoticeTextArea.setPrefSize(290, 120);
publicNoticeTextArea.setLayoutX(nameField.getLayoutX());
publicNoticeTextArea.setLayoutY(publicNoticeLabel.getLayoutY());
AnchorPane infoPane = new AnchorPane();
infoPane.setStyle("-fx-background-color:#ffffff");
infoPane.getChildren().add(nameLabel);
infoPane.getChildren().add(introduceLabel);
infoPane.getChildren().add(publicNoticeLabel);
infoPane.getChildren().add(nameField);
infoPane.getChildren().add(introduceTextArea);
infoPane.getChildren().add(publicNoticeTextArea);
cancelButton.setText("取消");
cancelButton.setPrefWidth(80);
button.setText("确定");
button.setPrefWidth(80);
bottomBox.setStyle("-fx-background-color:#c9e1e9");
bottomBox.setAlignment(Pos.BASELINE_RIGHT);
bottomBox.setPadding(new Insets(5, 10, 5, 10));
bottomBox.setSpacing(10);
bottomBox.getChildren().add(button);
bottomBox.getChildren().add(cancelButton);
//VBox vBox=new VBox();
infoPane.getChildren().add(imagePanel);
//vBox.getChildren().add(infoPane);
rootPane.setCenter(infoPane);
rootPane.setBottom(bottomBox);
}
private void initComponent() {
this.setWidth(420);
this.setHeight(120);
this.setResizable(false);
this.setTitlePaneStyle(2);
this.setRadius(5);
this.setCenter(rootPane);
this.setTitle("服务器地址设置");
Label nameLabel = new Label("服务器地址:");
addressField.setPromptText("服务器地址");
nameLabel.setPrefSize(75, 25);
nameLabel.setLayoutX(10);
nameLabel.setLayoutY(5);
addressField.setPrefSize(300, 25);
addressField.setLayoutX(nameLabel.getLayoutX() + nameLabel.getPrefWidth() + 10);
addressField.setLayoutY(nameLabel.getLayoutY());
AnchorPane infoPane = new AnchorPane();
infoPane.setStyle("-fx-background-color:#ffffff");
infoPane.getChildren().add(nameLabel);
infoPane.getChildren().add(addressField);
cancelButton.setText("取消");
cancelButton.setPrefWidth(80);
button.setText("确定");
button.setPrefWidth(80);
bottomBox.setStyle("-fx-background-color:#c9e1e9");
bottomBox.setAlignment(Pos.BASELINE_RIGHT);
bottomBox.setPadding(new Insets(5, 10, 5, 10));
bottomBox.setSpacing(10);
bottomBox.getChildren().add(button);
bottomBox.getChildren().add(cancelButton);
rootPane.setTop(topBox);
rootPane.setCenter(infoPane);
rootPane.setBottom(bottomBox);
}
public OverView() {
root = new Pane();
Game.getInstance().resetMedia();
GameMap map = Game.getInstance().getMapManager().getCurrentMap();
ImageView mapIv = new ImageView(map.getMapImage());
mapIv.setFitWidth(Game.getInstance().getWidth());
mapIv.setFitHeight(Game.getInstance().getHeight());
Label nameLbl = new Label("Game Over!");
nameLbl.setTextFill(Color.WHITESMOKE);
nameLbl.setFont(Game.getInstance().getResouceManager().getFont("Starcraft", 80));
nameLbl.setLayoutX(50);
nameLbl.setLayoutY(50);
Label scoreLbl = new Label();
scoreLbl.setTextFill(Color.WHITESMOKE);
scoreLbl.setFont(Game.getInstance().getResouceManager().getFont("Starcraft", 60));
scoreLbl.setLayoutX(50);
scoreLbl.setLayoutY(map.getHeight() - scoreLbl.getHeight() - 140);
if (Game.getInstance().getScore() > Game.getInstance().getDataManager().getHighestScore()) {
// 刷新高分记录!
scoreLbl.setText("New Record: " + Game.getInstance().getScore());
Game.getInstance().getDataManager().setHighestScore(Game.getInstance().getScore());
} else
scoreLbl.setText("Score: " + Game.getInstance().getScore());
Reflection reflection = new Reflection();
reflection.setFraction(1.0);
nameLbl.setEffect(reflection);
ImageView homeBtn = new ImageView(Game.getInstance().getResouceManager().getControl("btn_home"));
homeBtn.setFitWidth(165 * 1.5);
homeBtn.setFitHeight(65 * 1.5);
homeBtn.setLayoutX(map.getWidth() - homeBtn.getFitWidth() - 20);
homeBtn.setLayoutY(map.getHeight() - homeBtn.getFitHeight() - 60);
homeBtn.setEffect(reflection);
homeBtn.setOnMouseEntered(event -> {
homeBtn.setEffect(new Glow(0.8));
Game.getInstance().getButtonOverMusic().play();
});
homeBtn.setOnMouseExited(event -> {
homeBtn.setEffect(reflection);
Game.getInstance().getButtonOverMusic().stop();
});
homeBtn.setOnMousePressed(event -> {
homeBtn.setEffect(new GaussianBlur());
Game.getInstance().getButtonClickMusic().play();
});
homeBtn.setOnMouseReleased(event -> {
homeBtn.setEffect(new Glow(0.8));
Game.getInstance().home();
});
root.getChildren().add(mapIv);
root.getChildren().add(nameLbl);
root.getChildren().add(scoreLbl);
root.getChildren().add(homeBtn);
makeFadeTransition(homeBtn, 2000, 1, 0.7);
makeFadeTransition(mapIv, 3000, 1, 0.8);
makeScaleTransition(mapIv, 10000, 0.25, 0.25);
}
@Override
public Scene createScene() {
GeometryNode<RoundedRectangle> end1 = new GeometryNode<>(
new RoundedRectangle(50, 50, 30, 30, 20, 20));
end1.setFill(Color.RED);
end1.setStrokeWidth(3);
end1.setStrokeType(StrokeType.OUTSIDE);
makeDraggable(end1);
// use a shape
javafx.scene.shape.Rectangle end2 = new javafx.scene.shape.Rectangle(
200, 50, 30, 30);
end2.setArcWidth(20);
end2.setArcHeight(20);
end2.setStroke(Color.BLACK);
end2.setFill(Color.RED);
end2.setStrokeWidth(3);
end2.setStrokeType(StrokeType.OUTSIDE);
makeDraggable(end2);
// use a control as start, where layout bounds are always (0, 0, width,
// height); this demonstrates anchor positions are calculated properly
Label start = new Label("Some label");
start.setLayoutX(150);
start.setLayoutY(150);
makeDraggable(start);
// start.setBackground(new Background(new BackgroundFill(Color.GREY,
// CornerRadii.EMPTY, new Insets(0))));
// start.setBorder(
// new Border(new BorderStroke(Color.BLUE, BorderStrokeStyle.SOLID,
// CornerRadii.EMPTY, new BorderWidths(10))));
// set start point and end anchor
// create connection, provide decoration
Connection connection1 = new Connection();
connection1.setEndDecoration(new ArrowHead());
connection1.setStartAnchor(new DynamicAnchor(start));
connection1.setEndAnchor(new DynamicAnchor(end1));
Connection connection2 = new Connection();
connection2.setRouter(new OrthogonalRouter());
connection2.setEndDecoration(new ArrowHead());
connection2.setStartAnchor(
new DynamicAnchor(start, new OrthogonalProjectionStrategy()));
connection2.setEndAnchor(
new DynamicAnchor(end2, new OrthogonalProjectionStrategy()));
Group root = new Group();
root.getChildren().addAll(start, end1, end2, connection1, connection2);
return new Scene(root, 300, 300);
}
public DualPanel createInputPane() {
DualPanel retVal = new DualPanel();
LabelledRadiusPane left = new LabelledRadiusPane("Input Tweet");
TextArea lArea = new TextArea();
lArea.setWrapText(true);
lArea.setFont(Font.font("Helvetica", FontWeight.MEDIUM, 16));
lArea.layoutYProperty().bind(left.labelHeightProperty().add(10));
left.layoutBoundsProperty().addListener((v, o, n) -> {
lArea.setLayoutX(10);
lArea.setPrefWidth(n.getWidth() - 20);
lArea.setPrefHeight(n.getHeight() - left.labelHeightProperty().get() - 20);
});
Label queueLabel = new Label("Processing Queue Size:");
queueLabel.layoutXProperty().bind(lArea.widthProperty().subtract(queueLabel.getLayoutBounds().getWidth() + 330));
queueLabel.setLayoutY(lArea.getLayoutY() - queueLabel.getLayoutBounds().getHeight() - 35);
queueLabel.setFont(Font.font("Helvetica", FontWeight.BOLD, 12));
queueLabel.setTextFill(Color.rgb(00, 70, 107));
queueDisplayProperty.set(queueLabel);
Label curLabel = new Label("Current Tweet:");
curLabel.layoutXProperty().bind(lArea.widthProperty().subtract(curLabel.getLayoutBounds().getWidth() + 110));
curLabel.setLayoutY(lArea.getLayoutY() - curLabel.getLayoutBounds().getHeight() - 35);
curLabel.setFont(Font.font("Helvetica", FontWeight.BOLD, 12));
curLabel.setTextFill(Color.rgb(00, 70, 107));
currentLabelProperty.set(curLabel.textProperty());
left.getChildren().addAll(lArea, queueLabel, curLabel);
LabelledRadiusPane right = new LabelledRadiusPane("Scrubbed Tweet");
TextArea rArea = new TextArea();
rArea.setWrapText(true);
rArea.setFont(Font.font("Helvetica", FontWeight.MEDIUM, 16));
rArea.layoutYProperty().bind(right.labelHeightProperty().add(10));
right.layoutBoundsProperty().addListener((v, o, n) -> {
rArea.setLayoutX(10);
rArea.setPrefWidth(n.getWidth() - 20);
rArea.setPrefHeight(n.getHeight() - right.labelHeightProperty().get() - 20);
});
right.getChildren().add(rArea);
retVal.setLeftPane(left);
retVal.setRightPane(right);
inputPaneProperty.set(new Pair<>(lArea, rArea));
return retVal;
}
/**
* Creates the monitor view
* @return
*/
public LabelledRadiusPane createActivityPane() {
LabelledRadiusPane retVal = new LabelledRadiusPane("Activity Monitor");
HBox h = new HBox();
h.setFillHeight(true);
h.setSpacing(15);
h.setPadding(new Insets(0, 10, 10, 15));
h.prefWidthProperty().bind(retVal.widthProperty());
h.layoutYProperty().bind(retVal.labelHeightProperty().add(20));
TextArea area = new TextArea();
area.prefWidthProperty().bind(h.widthProperty().subtract(30).divide(2));
area.prefHeightProperty().bind(retVal.heightProperty().subtract(60));
area.setLayoutY(retVal.labelHeightProperty().add(0).get());
leftActivityPanelProperty.set(area);
TextArea area2 = new TextArea();
area2.prefWidthProperty().bind(h.widthProperty().subtract(60).divide(2));
area2.prefHeightProperty().bind(retVal.heightProperty().subtract(60));
area2.setLayoutY(retVal.labelHeightProperty().add(0).get());
area2.textProperty().addListener((v, o, n) -> {
area2.setScrollTop(Double.MAX_VALUE);
area2.setScrollLeft(Double.MAX_VALUE);
});
rightActivityPanelProperty.set(area2);
h.getChildren().addAll(area, area2);
Label l = new Label("Output");
l.setFont(Font.font("Helvetica", FontWeight.BOLD, 14));
l.setTextFill(Color.rgb(00, 70, 107));
l.layoutXProperty().bind(area.widthProperty().divide(2).add(area.getLayoutX()).subtract(l.getWidth()));
l.setLayoutY(area.getLayoutY() - l.getHeight());
Label l2 = new Label("Similar Tweets");
l2.setFont(Font.font("Helvetica", FontWeight.BOLD, 14));
l2.setTextFill(Color.rgb(00, 70, 107));
area2.layoutBoundsProperty().addListener((v, o, n) -> {
l2.setLayoutX(area.getWidth() + 60 + area2.getWidth() / 2 - l2.getWidth());
});
l2.setLayoutY(area2.getLayoutY() - l.getHeight());
retVal.getChildren().addAll(h, l, l2);
return retVal;
}
public ProjectorArenaPane(Stage arenaStage, Stage shootOffStage, Pane trainingExerciseContainer, Resetter resetter,
ObservableList<ShotEntry> shotTimerModel) {
config = Configuration.getConfig();
arenaCanvasGroup = new Group();
calibrationLabel = new Label("Needs Calibration");
calibrationLabel.setFont(Font.font(48));
calibrationLabel.setTextFill(Color.web("#f5a807"));
calibrationLabel.setLayoutX(6);
calibrationLabel.setLayoutY(6);
calibrationLabel.setPrefSize(628, 90);
calibrationLabel.setAlignment(Pos.CENTER);
getChildren().addAll(arenaCanvasGroup, calibrationLabel);
this.shootOffStage = shootOffStage;
this.arenaStage = arenaStage;
this.trainingExerciseContainer = trainingExerciseContainer;
if (config.isHeadless()) {
canvasManager = new CanvasManager(arenaCanvasGroup, resetter, "arena", shotTimerModel);
} else {
canvasManager = new MirroredCanvasManager(arenaCanvasGroup, resetter, "arena", shotTimerModel, this);
}
setPrefSize(640, 480);
setOnKeyPressed((event) -> canvasKeyPressed(event));
setOnMouseEntered((event) -> requestFocus());
setOnMouseClicked((event) -> {
canvasManager.toggleTargetSelection(Optional.empty());
});
arenaStage.widthProperty().addListener((e) -> {
canvasManager.setBackgroundFit(arenaStage.getWidth(), arenaStage.getHeight());
});
arenaStage.heightProperty().addListener((e) -> {
canvasManager.setBackgroundFit(arenaStage.getWidth(), arenaStage.getHeight());
});
setStyle("-fx-background-color: #333333;");
}
public BsqAddressTextField() {
TextField textField = new BisqTextField();
textField.setId("address-text-field");
textField.setEditable(false);
textField.textProperty().bind(address);
String tooltipText = Res.get("addressTextField.copyToClipboard");
textField.setTooltip(new Tooltip(tooltipText));
textField.setOnMousePressed(event -> wasPrimaryButtonDown = event.isPrimaryButtonDown());
textField.setOnMouseReleased(event -> {
if (wasPrimaryButtonDown && address.get() != null && address.get().length() > 0) {
Utilities.copyToClipboard(address.get());
Notification walletFundedNotification = new Notification()
.notification(Res.get("addressTextField.addressCopiedToClipboard"))
.hideCloseButton()
.autoClose();
walletFundedNotification.show();
}
wasPrimaryButtonDown = false;
});
textField.focusTraversableProperty().set(focusTraversableProperty().get());
//TODO app wide focus
//focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus());
Label copyIcon = new Label();
copyIcon.setLayoutY(3);
copyIcon.getStyleClass().addAll("icon", "highlight");
copyIcon.setTooltip(new Tooltip(Res.get("addressTextField.copyToClipboard")));
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
copyIcon.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(() -> {
if (address.get() != null && address.get().length() > 0)
Utilities.copyToClipboard(address.get());
}));
AnchorPane.setRightAnchor(copyIcon, 5.0);
AnchorPane.setRightAnchor(textField, 30.0);
AnchorPane.setLeftAnchor(textField, 0.0);
getChildren().addAll(textField, copyIcon);
}
public AddressTextField(String label) {
JFXTextField textField = new BisqTextField();
textField.setId("address-text-field");
textField.setEditable(false);
textField.setLabelFloat(true);
textField.setPromptText(label);
textField.textProperty().bind(address);
String tooltipText = Res.get("addressTextField.openWallet");
textField.setTooltip(new Tooltip(tooltipText));
textField.setOnMousePressed(event -> wasPrimaryButtonDown = event.isPrimaryButtonDown());
textField.setOnMouseReleased(event -> {
if (wasPrimaryButtonDown)
GUIUtil.showFeeInfoBeforeExecute(AddressTextField.this::openWallet);
wasPrimaryButtonDown = false;
});
textField.focusTraversableProperty().set(focusTraversableProperty().get());
//TODO app wide focus
//focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus());
Label extWalletIcon = new Label();
extWalletIcon.setLayoutY(3);
extWalletIcon.getStyleClass().addAll("icon", "highlight");
extWalletIcon.setTooltip(new Tooltip(tooltipText));
AwesomeDude.setIcon(extWalletIcon, AwesomeIcon.SIGNIN);
extWalletIcon.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(this::openWallet));
Label copyIcon = new Label();
copyIcon.setLayoutY(3);
copyIcon.getStyleClass().addAll("icon", "highlight");
Tooltip.install(copyIcon, new Tooltip(Res.get("addressTextField.copyToClipboard")));
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
copyIcon.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(() -> {
if (address.get() != null && address.get().length() > 0)
Utilities.copyToClipboard(address.get());
}));
AnchorPane.setRightAnchor(copyIcon, 30.0);
AnchorPane.setRightAnchor(extWalletIcon, 5.0);
AnchorPane.setRightAnchor(textField, 55.0);
AnchorPane.setLeftAnchor(textField, 0.0);
getChildren().addAll(textField, copyIcon, extWalletIcon);
}