package pic3;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.scene.Group;
import javafx.scene.image.*;
import javafx.scene.shape.Rectangle;
import javafx.scene.image.Image;
import javafx.scene.paint.Color;
import javafx.scene.shape.Polygon;
import javafx.scene.shape.Line;
import javafx.scene.input.MouseEvent;
import javafx.scene.control.Label;
public class pro extends Application {
Image[] img=new Image[10];
ImageView[] imv=new ImageView[10];
int s,sx,w,h;
String pic;
Label lx;
int page;
public static void main(String args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
lx=new Label();
for(page=1;page<10;page++){
pic="https://sites.google.com/site/2chpdf/toranpu/h0"+page+".gif?attredirects=0";
img[page] = new Image(pic);
imv[page] = new ImageView();
imv[page].setImage(img[page]);
imv[page].setFitWidth(200);
imv[page].setFitHeight(200);
}
page=1;
lx.setGraphic(imv[page]);
lx.setLayoutX(50);
lx.setLayoutY(50);
Button btn = new Button();
btn.setText("->");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
page=page+1;
if(page>9)page=1;
lx.setGraphic(imv[page]);
}
});
btn.setLayoutX(300);
btn.setLayoutY(20);
Group root = new Group();
Scene scene = new Scene(root, 500, 500);
root.getChildren().add(lx);
root.getChildren().add(btn);
primaryStage.setTitle("don");
primaryStage.setScene(scene);
primaryStage.show();
}
}
最終更新:2013年08月30日 14:06