0
私のラベル(lbl)にElipsis String(...)を保持しようとしていますが、ウィンドウが小さくなりすぎると空のStringに設定されます。私は例を示すためにここにコードを使用しています。私はここにあるResizeHelperクラスを使用しています:Allow user to resize an undecorated Stage。JavaFXラベルに唯一のテキストが表示されている場合、省略記号文字列を空の文字列に設定する方法
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
/**
*
* @author bparmeter
*/
public class NewFXMain extends Application {
@Override
public void start(Stage primaryStage) {
Label lbl = new Label();
lbl.setText("Hello World");
AnchorPane root = new AnchorPane();
AnchorPane.setBottomAnchor(lbl, 0.0);
AnchorPane.setTopAnchor(lbl, 0.0);
AnchorPane.setRightAnchor(lbl, 0.0);
AnchorPane.setLeftAnchor(lbl, 0.0);
root.getChildren().add(lbl);
Scene scene = new Scene(root, 300, 250);
primaryStage.setScene(scene);
primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStage.show();
ResizeHelper.addResizeListener(primaryStage);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}