アットウィキロゴ

pp87

package ren;
 
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.image.Image;
import java.io.File;
import static javafx.application.Application.launch;
import javafx.scene.image.ImageView;
 import javafx.scene.Group;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
 
import javafx.scene.shape.*;
import javafx.scene.input.MouseEvent;
 
import tool.*;
 
public class pro extends Application {
 
 GraphicsContext gc;    
 
int w=519;
int h=767;          
int[][] memor=new int[h][w]; 
int[][] memog=new int[h][w]; 
int[][] memob=new int[h][w];  
int number;
int[][] df=new int[h][w];
 
int[] px=new int[10000];
int[] py=new int[10000];
int xx,yy;
 
int[] countx=new int[100];
int[] county=new int[100];
  int[] routex=new int[10000];
int[] routey=new int[10000];
    int n,datanumber;
String[] data=new String[50000];
 int s;   
 
    public static void main(String[] args) {
        launch(args);
    }
 
 
 
    @Override
    public void start(Stage primaryStage) {
 
 
        readfile sub=new readfile();
        sub.makedata("g.txt","SJIS");
        datanumber=sub.datanumber;
        data=sub.data;
 
for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");        
px[s]=Integer.parseInt(x[0]);
py[s]=Integer.parseInt(x[1]);
}
 
 
  Canvas canvas = new Canvas(600,800);
 gc = canvas.getGraphicsContext2D();
canvas.setLayoutX(10);
canvas.setLayoutY(10);
 
gc.setFill(Color.WHITE);
gc.fillRect(0,0,550,770);
 
double x1,y1,x2,y2;
 
 for(s=1;s<datanumber;s++){
 gc.setFill(Color.RED);               
x1=px[s];
y1=py[s];
x2=px[s+1];
y2=py[s+1];
 gc.strokeLine(x1,y1,x2,y2);
                }     
 
 s=datanumber;
gc.setFill(Color.RED);               
x1=px[s];
y1=py[s];
x2=px[1];
y2=py[1];
 gc.strokeLine(x1,y1,x2,y2);
 
 double[] pxs=new double[10000];
double[] pys=new double[10000];
 
for(s=0;s<datanumber;s++){ 
pxs[s]=px[s+1];
pys[s]=py[s+1];
}
 
 
 gc.fillPolygon(pxs,pys,datanumber);
 
 
 
 
 
       Group root = new Group();
Scene scene = new Scene(root, 800, 800);    
        root.getChildren().add(canvas);
 
 
        primaryStage.setTitle("pic");
        primaryStage.setScene(scene);
        primaryStage.show();
    }
 
 
}
最終更新:2016年05月01日 08:57