私はフォルダ内にある(javafxモーションブラーを使用して)フォルダ内にある5つの画像を順に選択するのではなく、編集しようとしています。これは私のコードです、私は間違って何をしているのか正確にはわかりませんが、私がそれを実行すると、フォルダ内の最後の画像だけが編集されます。他のものはそのままです。JavaFX一括編集画像
ときprimaryStage最初のショー()、その命令のFXスレッドの一時停止、残りの画像はなりませんので、public class IterateThrough extends Application {
private Desktop desktop = Desktop.getDesktop();
@Override
public void start(Stage primaryStage) throws IOException {
File dir = new File("filepath");
File [] directoryListing = dir.listFiles();
if (directoryListing != null) {
for (File file : directoryListing) {
if(file.getName().toLowerCase().endsWith(".jpeg")){
//desktop.open(file);
Image image = new Image(new FileInputStream(file));
//Setting the image view
ImageView imageView = new ImageView(image);
//setting the fit height and width of the image view
imageView.setFitHeight(600);
imageView.setFitWidth(500);
//Setting the preserve ratio of the image view
imageView.setPreserveRatio(true);
// instantiate Motion Blur class
MotionBlur motionBlur = new MotionBlur();
// set blur radius and blur angle
motionBlur.setRadius(15.0);
motionBlur.setAngle(110.0);
//set imageView effect
imageView.setEffect(motionBlur);
//Creating a Group object
Group root = new Group(imageView);
//Creating a scene object
Scene scene = new Scene(root, 600, 500);
//Setting title to the Stage
primaryStage.setTitle("Loading an image");
//Adding scene to the stage
primaryStage.setScene(scene);
//Displaying the contents of the stage
primaryStage.show();
}
}
}
}
public static void main(String[] args) {
launch(args);
}
}
I「には、ディスプレイを」あなたが意味する単語「編集」を使用していると仮定しますが、私はまだあなたが何をしようとして理解していません。あなたは、すべての画像を同時に表示したいですか?トランジションエフェクトとしてぼかしを使用しながら、それらを1つずつ表示しようとしていますか? – VGR
@VGR私はトランジションエフェクトとしてぼかしを使っている間、一度に1つずつ表示しようとしています。 – diamondgirl
[タイムライン](http://docs.oracle.com/javase/8/javafx/api/javafx/animation/Timeline.html)を使用することをお勧めします。しかし、まず、遷移をどのように見せたいかを明確に定義する必要があります。単に画像をぼかしても、トランジション効果はありません。 1つの画像を次第にぼかすようにした後、次の画像のぼかしたバージョンに置き換えて徐々に消えるようにしましたか? – VGR