本文整理汇总了Java中javafx.scene.control.Label.setTranslateX方法的典型用法代码示例。如果您正苦于以下问题:Java Label.setTranslateX方法的具体用法?Java Label.setTranslateX怎么用?Java Label.setTranslateX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Label
的用法示例。
在下文中一共展示了Label.setTranslateX方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: aendereReihenfolge
import javafx.scene.control.Label; //导入方法依赖的package包/类
private void aendereReihenfolge(){
Stage stage = new Stage();
Label l = new Label("Reihenfolge festlegen:");
l.setStyle("-fx-text-fill: white");
l.setFont(Font.font(settingsFontSize));
l.setTranslateY(25);
l.setTranslateX(25);
TextField tf = new TextField(String.valueOf(orderId+1));
tf.setFont(Font.font(settingsFontSize-3));
tf.setTranslateX(25);
tf.setTranslateY(60);
Button b = new Button("Speichern");
b.setFont(Font.font(settingsFontSize));
b.setTranslateX(25);
b.setTranslateY(120);
b.setOnAction(e -> {
orderId = Integer.parseInt(tf.getText())-1;
stage.close();
Plugin_Gleisbelegung.sortiereGleiseListener();
});
Pane p = new Pane(l,tf,b);
p.setStyle("-fx-background-color: #303030");
p.setMinSize(500,200);
p.setMaxSize(500, 200);
Scene scene = new Scene(p, 300,200);
stage.setScene(scene);
stage.show();
stage.setAlwaysOnTop(true);
}
示例2: openLogWindow
import javafx.scene.control.Label; //导入方法依赖的package包/类
private void openLogWindow(){
Stage stage = new Stage();
//Label l = new Label("Während deiner aktuellen Sitzung sind Fehler aufgetreten. Durch einen Klick auf Weiter werden deine Log-Datei und deine Anregungen anonym hochgeladen.");
Label l = new Label("Während deiner aktuellen Sitzung sind Fehler aufgetreten. Durch einen Klick auf Weiter wird deine Log-Datei anonym hochgeladen.");
l.setStyle("-fx-text-fill: white");
l.setFont(Font.font(settingsFontSize));
l.setWrapText(true);
l.setMaxWidth(450);
l.setTranslateY(25);
l.setTranslateX(25);
/*TextField ta = new TextField();
ta.setFont(Font.font(settingsFontSize-3));
ta.setTranslateX(25);
ta.setTranslateY(125);
ta.setPrefWidth(450);
ta.setPrefHeight(100);*/
Button bno = new Button("Abbrechen");
bno.setFont(Font.font(settingsFontSize));
bno.setOnAction(e -> stage.close());
bno.setTranslateX(250);
bno.setTranslateY(150);
Button byes = new Button("Weiter");
byes.setFont(Font.font(settingsFontSize));
byes.setTranslateX(150);
byes.setTranslateY(150);
byes.setOnAction(e -> {
byes.setDisable(true);
bno.setDisable(true);
Runnable r = () -> {
sendLogFile(l);
};
new Thread(r).start();
});
Pane p = new Pane(l, byes, bno);
p.setStyle("-fx-background-color: #303030");
p.setMinSize(500,200);
p.setMaxSize(500, 200);
Scene s = new Scene(p,500,200);
stage.setScene(s);
stage.setTitle("Log-Datei senden?");
stage.setAlwaysOnTop(true);
stage.show();
}
示例3: initializePropertyTag
import javafx.scene.control.Label; //导入方法依赖的package包/类
private void initializePropertyTag() {
final TagPresentation propertyTag = controller.propertyTag;
final Line propertyTagLine = controller.propertyTagLine;
propertyTag.setComponent(controller.getComponent());
propertyTag.setLocationAware(controller.getNail());
// Bind the line to the tag
BindingHelper.bind(propertyTagLine, propertyTag);
// Bind the color of the tag to the color of the component
propertyTag.bindToColor(controller.getComponent().colorProperty(), controller.getComponent().colorIntensityProperty());
// Updates visibility and placeholder of the tag depending on the type of nail
final Consumer<Edge.PropertyType> updatePropertyType = (propertyType) -> {
// If it is not a property nail hide the tag otherwise show it and write proper placeholder
if(propertyType.equals(Edge.PropertyType.NONE)) {
propertyTag.setVisible(false);
} else {
// Show the property tag since the nail is a property nail
propertyTag.setVisible(true);
// Set and bind the location of the property tag
if((controller.getNail().getPropertyX() != 0) && (controller.getNail().getPropertyY() != 0)) {
propertyTag.setTranslateX(controller.getNail().getPropertyX());
propertyTag.setTranslateY(controller.getNail().getPropertyY());
}
controller.getNail().propertyXProperty().bind(propertyTag.translateXProperty());
controller.getNail().propertyYProperty().bind(propertyTag.translateYProperty());
Label propertyLabel = controller.propertyLabel;
if(propertyType.equals(Edge.PropertyType.SELECTION)) {
propertyTag.setPlaceholder("Select");
propertyLabel.setText(":");
propertyLabel.setTranslateX(-3);
propertyLabel.setTranslateY(-8);
propertyTag.setAndBindString(controller.getEdge().selectProperty());
} else if(propertyType.equals(Edge.PropertyType.GUARD)) {
propertyTag.setPlaceholder("Guard");
propertyLabel.setText("<");
propertyLabel.setTranslateX(-3);
propertyLabel.setTranslateY(-7);
propertyTag.setAndBindString(controller.getEdge().guardProperty());
} else if(propertyType.equals(Edge.PropertyType.SYNCHRONIZATION)) {
propertyTag.setPlaceholder("Sync");
propertyLabel.setText("!?");
propertyLabel.setTranslateX(-6);
propertyLabel.setTranslateY(-7);
propertyTag.setAndBindString(controller.getEdge().syncProperty());
} else if(propertyType.equals(Edge.PropertyType.UPDATE)) {
propertyTag.setPlaceholder("Update");
propertyLabel.setText("=");
propertyLabel.setTranslateX(-3);
propertyLabel.setTranslateY(-7);
propertyTag.setAndBindString(controller.getEdge().updateProperty());
}
propertyTag.requestTextFieldFocus();
propertyTag.requestTextFieldFocus(); // Requesting it twice is needed for some reason
}
};
// Whenever the property type updates update the tag
controller.getNail().propertyTypeProperty().addListener((obs, oldPropertyType, newPropertyType) -> {
updatePropertyType.accept(newPropertyType);
});
// Update the tag initially
updatePropertyType.accept(controller.getNail().getPropertyType());
}