Код: Выделить всё
public class TestFx extends Application {
@Override
public void start(Stage primaryStage) {
var text = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var font = Font.font("System", 24);
Label topLabel = new Label(text);
topLabel.setFont(font);
topLabel.setStyle("-fx-background-color: yellow");
Label bottomLabel = new Label(text);
bottomLabel.setFont(font);
bottomLabel.setStyle("-fx-background-color: orange");
// Calculate the distance from the baseline of topLabel
// to the top of the bottomLabel
//double baselineToTop = ???; // What should go here?
VBox root = new VBox(topLabel, bottomLabel);
Scene scene = new Scene(root, 600, 200);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Может ли кто -нибудь сказать, как это сделать?
Подробнее здесь: https://stackoverflow.com/questions/796 ... t-in-anoth