Bonjour à tous,
J'ai un peit soucis au niveau des package de GUI java (JavaFx).
Mon probléme que qd je veux execute le code suivant:
Le terminal me repond:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.*; import javafx.scene.paint.Color; import javafx.stage.Stage; public class Main extends Application { @Override public void init() { System.out.println("Initialization (init())"); } @Override public void start(Stage mainStage) { System.out.println("Running (start(Stage))"); // Title of the window mainStage.setTitle("My First JavaFX App"); // Start by building the "Hello JavaFX" button Button btnHello = new Button("Hello JavaFX"); // It can be resized, and we can add a background and a border (inherit from Region) //btnHello.setPrefSize(120,80); btnHello.setBorder(new Border(new BorderStroke(Color.DARKRED, BorderStrokeStyle.SOLID, null, new BorderWidths(5)))); btnHello.setPadding(new Insets(20,50,40,100)); // Define the main container (e.g. any layout-pane) and add the button BorderPane root = new BorderPane(); root.setCenter(btnHello); // Build the Scene by giving the root pane Scene scene = new Scene(root, 250, 100); // Finally, set the Scene in the Stage and show the window mainStage.setScene(scene); mainStage.show(); } @Override public void stop() { System.out.println("Closing (stop())"); } public static void main(String[] args) { launch(args); } }
Quel est le probléme ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 error: package javafx.application does not exist import javafx.application.Application; ^ Main.java:2: error: package javafx.geometry does not exist import javafx.geometry.Insets; ^ Main.java:3: error: package javafx.scene does not exist import javafx.scene.Scene; ^ Main.java:4: error: package javafx.scene.control does not exist import javafx.scene.control.Button; ^ Main.java:6: error: package javafx.scene.paint does not exist import javafx.scene.paint.Color; ^ Main.java:7: error: package javafx.stage does not exist import javafx.stage.Stage;
Est ce que les package de JavaFx ne sont pas installé ? si non , cmt les installé ?
Merci d'avance de vos préciseuses information qui seront fournis
Ps:
qd je tappecela me donne:
Code : Sélectionner tout - Visualiser dans une fenêtre à part java -version
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 openjdk version "1.8.0_222" OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10) OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
Partager