アットウィキロゴ

とr

package teump;
 
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import java.io.File;
import javafx.scene.input.MouseEvent;
 
 
 
public class pro extends Application {
 
    ImageView[] imv = new ImageView[52];
    Image[] im = new Image[52];
 int s,number;
 
    public static void main(String[] args) {
        launch(args);
    }
 
 
 
 
    @Override
    public void start(Stage primaryStage) {
 
 
        File fx=new File("data");
        String[] f=fx.list();
 
 
    for(s=0;s<52;s++){    
im[s]= new Image("file:data/"+f[s]);
    }
 
for(s=1;s<6;s++){
imv[s] = new ImageView();
imv[s].setImage(im[s]);
imv[s].setFitWidth(100);
imv[s].setFitHeight(100);
imv[s].setX(100*s);
imv[s].setY(200);
}
 
 
 
Group root = new Group();
Scene scene = new Scene(root, 700, 700); 
 
for(s=1;s<6;s++){
root.getChildren().add(imv[s]);
}
 
 
 
imv[1].addEventFilter(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
    @Override
    public void handle(MouseEvent mouseEvent) {
        System.out.println(1);
    }
});
 
 
 
imv[2].addEventFilter(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
    @Override
    public void handle(MouseEvent mouseEvent) {
        System.out.println(2);
    }
});
 
 
 
 
primaryStage.setTitle("トランプ");
primaryStage.setScene(scene);
primaryStage.show();
 
 
    }
 
 
 
}
 
最終更新:2014年04月26日 05:35