2017-02-19 15 views
1

私は現在、javafx UIでサポートされているJavaゲームに取り組んでいます。JavaFX対話 - ゲーム

プレーヤー。問題ないnpcと話すことができるはずです。しかし、私はあるテックス効果が欲しい。ポストモンのゲームのように、またはテキストが手紙のためのゆっくりと表示されているところで下さる。

どうすればこの問題を解決できますか?

答えて

0
Label label = /* the label */ ; 
String text = /* text to display */; 

IntegerProperty lettersDisplayed = new SimpleIntegerProperty(); 
label.textProperty().bind(Bindings.createStringProperty(
    () -> text.substring(0, lettersDisplayed.get()), 
    lettersDisplayed); 

Timeline textAnimation = new Timeline(
    new KeyFrame(Duration.seconds(2), new KeyValue(lettersDisplayed, text.length())) 
); 
+0

iは、このやってしまった: –

+0

タイムラインfiveSecondsWonder2 =新しいタイムライン(新しいキーフレーム(Duration.seconds(0.05)、新しいイベントハンドラを(){ \t \t \tます。public voidハンドル(のActionEventイベント){\t \t \t \t \t \t textMessage.setText(i)は、(0 one.substring);; \t \t \t \t \t I ++は、 \t \t \t} \t \t})); \t \t fiveSecondsWonder2.setCycleCount(one.length()); \t \t fiveSecondsWonder2.play(); \t} –

+0

これは大丈夫ですか? –