アットウィキロゴ

fx3

package neko;
 
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.layout.StackPane;
import javafx.stage.Stage;
import javafx.scene.shape.Circle;
 
import javafx.scene.paint.Color;
  import javafx.scene.text.*;
 
public class pro extends Application {
 
    Text[][] maru=new Text[9][9];
    int[][] point=new int[9][9]; 
 int s,sx;
 Circle cc;
 
 int px,py;
 
 
    public static void main(String[] args) {
        launch(args);
    }
 
 
    @Override
    public void start(Stage primaryStage) {
 
 
        px=5;
        py=5;
 
        cc=new Circle();
 cc.setCenterX(50*px);
cc.setCenterY(50*py);
cc.setRadius(25.0f);
 
 
 
        for(s=1;s<9;s++){
        for(sx=1;sx<9;sx++){
        maru[s][sx]=new Text("abc");
        maru[s][sx].setLayoutX(50*s);
        maru[s][sx].setLayoutY(50*sx);   
        }
        }
 
        for(s=1;s<9;s++){
        for(sx=1;sx<9;sx++){
        point[s][sx]=0;
        }
        }
 
 
        Button btn = new Button();
        btn.setText("決定");
        btn.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                px=px-1;
                if(px<1)px=1;
 
                double x1,y1;
                x1=50*px;
                y1=50*py;
cc.setCenterX(x1);
cc.setCenterY(y1);
 
            }
        });
btn.setLayoutX(300);
btn.setLayoutY(650); 
 
 
 
Group root = new Group();
Scene scene = new Scene(root, 700, 700); 
root.getChildren().add(btn);
root.getChildren().add(cc);
 
for(s=1;s<9;s++){
        for(sx=1;sx<9;sx++){
root.getChildren().add(maru[s][sx]);
        }
}
 
        primaryStage.setTitle("ボタン");
        primaryStage.setScene(scene);
        primaryStage.show();
    }
 
 
}
最終更新:2014年03月19日 23:17