問題点
javafxのimport文が反応しなくなりました。
現在、Eclipseを使用しているのですが、以下のソースコードのimport文にまつわる部分全てに赤波線が引かれてしまいます。
また、その部分にカーソルを当てると以下のエラーメッセージ(?)が出てきます。
どのようにすれば直るのでしょうか?
該当のソースコード
java
1import java.util.ArrayList; 2 3import javafx.application.Application; 4import javafx.scene.Group; 5import javafx.scene.Scene; 6import javafx.scene.canvas.Canvas; 7import javafx.scene.canvas.GraphicsContext; 8import javafx.stage.Stage; 9import javafx.geometry.Point2D; 10 11public class GraphSinCos extends Application { 12 13 @Override 14 public void start(Stage stage) { 15 int i, y, N = 360, r = 100; 16 double theta; 17 18 stage.setWidth(400); 19 stage.setHeight(250); 20 21 Canvas canvas = new Canvas(400, 250); 22 GraphicsContext gc = canvas.getGraphicsContext2D(); 23 24 ArrayList<Point2D> Spoints = new ArrayList<>(); 25 ArrayList<Point2D> Cpoints = new ArrayList<>(); 26 27 gc.moveTo(0, 100); 28 for(i = 0; i <= N; i++){ 29 theta = 2 * Math.PI * i / N; 30 y = 100 - (int)(r * Math.sin(theta)); 31 32 Spoints.add(new Point2D(i, y)); 33 } 34 for(i = 0; i <= N; i++){ 35 gc.lineTo(Spoints.get(i).getX(), Spoints.get(i).getY()); 36 } 37 38 gc.moveTo(0, 100); 39 for(i = 0; i <= N; i++){ 40 theta = 2 * Math.PI * i / N; 41 y = 100 - (int)(r * Math.cos(theta)); 42 43 Cpoints.add(new Point2D(i, y)); 44 } 45 for(i = 0; i <= N; i++){ 46 gc.lineTo(Cpoints.get(i).getX(), Cpoints.get(i).getY()); 47 } 48 49 gc.stroke(); 50 51 Group root = new Group(); 52 root.getChildren().add(canvas); 53 54 Scene scene = new Scene(root); 55 56 stage.setScene(scene); 57 58 stage.show(); 59 } 60 61 public static void main(String[] args) { 62 launch(); 63 } 64}
発生している問題・エラーメッセージ
問題: アクセス制限: The type 'Application' is not API (restriction on required library '/Applications/Eclipse_2018-12.app/ Contents/java/8/Home/jre/lib/ext/jfxrt.jar')
質問のマナー等が間違っている、内容がわかりにくい等ありましたらご指摘お願いします。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。