アットウィキロゴ

v544

package pic;
 
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
import javafx.scene.Group;
import javafx.scene.shape.*;
import static javafx.application.Application.launch;
import javafx.scene.paint.Color;
 import javafx.scene.input.MouseEvent;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.canvas.Canvas;
import javafx.scene.image.PixelReader;
 import javafx.scene.canvas.GraphicsContext;
import javafx.geometry.Rectangle2D;
 
public class pro extends Application {
 
Canvas cam;
GraphicsContext gc;
 
public static void main(String[] args) {
launch(args);
}
 
 
@Override
public void start(Stage primaryStage) {
 
Image im = new Image("file:b.jpg");
 
double w1=im.getWidth();
double h1=im.getHeight();
 
int delta=0;
if(h1>w1)delta=100;
 
ImageView iv = new ImageView();
iv.setImage(im);
if(delta<50)iv.setFitWidth(500);
if(delta>50)iv.setFitHeight(500);  
iv.setPreserveRatio(true);
 
Group root = new Group();
Scene scene = new Scene(root, 700, 700); 
 
root.getChildren().add(iv);
primaryStage.setTitle("グラフ");
primaryStage.setScene(scene);
primaryStage.show();
 
}
 
 
 
}
最終更新:2015年11月20日 17:46