IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaFX Discussion :

Soucis de rafraîchissement de TableView ?


Sujet :

JavaFX

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2018
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2018
    Messages : 15
    Par défaut Soucis de rafraîchissement de TableView ?
    Bonjour, je développe une petite application de gestion pour m’entraîner. J'ai essayé d'y intégrer une fonction pour faire une genre de recherche filtrée dans ma base de donnée mais il y a l'air d'y avoir un soucis (je pense) au niveau du rafraîchissement du TableView.

    Je tiens à préciser que ma BDD est correcte, sur et certain, car les autres fonctionnalités de mon programme sont OK.

    Voici à quoi cela ressemble :
    Nom : rechercherJAVAFX.PNG
Affichages : 922
Taille : 30,0 Ko

    Voici le fichier FXML (créer avec SceneBuilder) :
    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
     
    <?xml version="1.0" encoding="UTF-8"?>
     
    <?import javafx.scene.control.Button?>
    <?import javafx.scene.control.ComboBox?>
    <?import javafx.scene.control.Label?>
    <?import javafx.scene.control.TableColumn?>
    <?import javafx.scene.control.TableView?>
    <?import javafx.scene.control.TextField?>
    <?import javafx.scene.layout.AnchorPane?>
     
     
    <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="535.0" prefWidth="992.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ControllerRechercherView">
       <children>
          <Label layoutX="14.0" layoutY="24.0" prefHeight="18.0" prefWidth="174.0" text="Titre" />
          <Label layoutX="14.0" layoutY="98.0" prefHeight="18.0" prefWidth="174.0" text="Interprète / Réalisateur" />
          <Label layoutX="14.0" layoutY="172.0" prefHeight="18.0" prefWidth="174.0" text="Type" />
          <Label layoutX="14.0" layoutY="252.0" prefHeight="18.0" prefWidth="174.0" text="Année de productions" />
          <Label layoutX="14.0" layoutY="326.0" prefHeight="18.0" prefWidth="174.0" text="Note ( /5)" />
          <TextField fx:id="titre" layoutX="14.0" layoutY="54.0" promptText="Titre" />
          <TextField fx:id="interpreterealisateur" layoutX="14.0" layoutY="127.0" promptText="Interprète / Réalisateur" />
          <ComboBox fx:id="type" layoutX="14.0" layoutY="200.0" prefHeight="26.0" prefWidth="189.0" promptText="Type" />
          <TextField fx:id="anneedeproduction" layoutX="14.0" layoutY="279.0" promptText="Année de production" />
          <TextField fx:id="note" layoutX="14.0" layoutY="353.0" promptText="Note ( /5)" />
          <Button layoutX="13.0" layoutY="447.0" mnemonicParsing="false" onAction="#BtnOnClick" prefHeight="39.0" prefWidth="190.0" text="Rechercher" />
          <Label fx:id="nbresult" layoutX="750.0" layoutY="504.0" prefHeight="18.0" prefWidth="174.0" />
          <TableView fx:id="tableprod" layoutX="218.0" layoutY="26.0" prefHeight="474.0" prefWidth="759.0">
             <columns>
                <TableColumn fx:id="titreColumn" prefWidth="154.39998817443848" text="Titre" />
                <TableColumn fx:id="interpreterealisateurColumn" prefWidth="177.60003662109375" text="Interprète / Réalisateur" />
                <TableColumn fx:id="typeColumn" prefWidth="121.5999755859375" text="Type" />
                <TableColumn fx:id="anneeprodColumn" prefWidth="200.79998779296875" text="Année de production" />
                <TableColumn fx:id="noteColumn" prefWidth="83.19992675781248" text="Note ( /5)" />
             </columns>
          </TableView>
       </children>
    </AnchorPane>
    Et voici son controller :
    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
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
     
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Calendar;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.event.ActionEvent;
    import javafx.fxml.FXML;
    import javafx.scene.control.Alert;
    import javafx.scene.control.ComboBox;
    import javafx.scene.control.Label;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.TextField;
     
    /*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
     
    /**
     *
     * @author Thibault Dereumaux
     */
    public class ControllerRechercherView {
     
        @FXML
        private TableView tableprod;
     
        @FXML
        private TextField titre;
     
        @FXML
        private TextField interpreterealisateur;
     
        @FXML
        private ComboBox<String> type;
     
        @FXML
        private TextField anneedeproduction;
     
        @FXML
        private TextField note;
     
        @FXML
        private Label nbresult;
     
     
        @FXML
        public void initialize() {
            type.getItems().removeAll(type.getItems());
            type.getItems().addAll("Musique", "Film");
        }
     
        private ObservableList<ObservableList> data;
     
        @FXML
        private TableColumn<ObservableList, String> titreColumn;
     
        @FXML
        private TableColumn<ObservableList, String> interpreterealisateurColumn;
     
        @FXML
        private TableColumn<ObservableList, String> typeColumn;
     
        @FXML
        private TableColumn<ObservableList, String> anneeprodColumn;
     
        @FXML
        private TableColumn<ObservableList, String> noteColumn;
     
        Statement stmtListe;
        Connexion maConnexion = new Connexion();
     
        @FXML
        void BtnOnClick(ActionEvent event) {
     
            String Titre = titre.getText();
            String Interpreterealisateur = interpreterealisateur.getText();
            String Type = (String)type.getValue();
            String anneeProduction = anneedeproduction.getText();
            String Note = note.getText();
            System.out.println(Type);
            String requeteRecherche;
     
            int noteInt = 0;
            int anneeProductionInt = 0;
            boolean FormatOk = true;
            int nbResultats = 0;
     
            Calendar c = Calendar.getInstance();
     
            if(!Note.isEmpty()) {
                try {
                noteInt = Integer.decode(Note);
                }
                catch (NumberFormatException ex) {
                System.err.println(ex);
                FormatOk = false;
                }
            }
     
            if(!anneeProduction.isEmpty()) {
                try {
                anneeProductionInt = Integer.decode(anneeProduction);
                }
                catch (NumberFormatException ex) {
                System.err.println(ex);
                FormatOk = false;
                }
            }
     
            if((noteInt < 0 || noteInt > 5 || anneeProductionInt > c.get(Calendar.YEAR) || anneeProductionInt < -1500) && (!Note.isEmpty() || !anneeProduction.isEmpty())) {
                FormatOk = false;
            }
     
            if (FormatOk == false) {
                nbresult.setText("");
                titre.setText("");
                interpreterealisateur.setText("");
                type.setValue("Type");
                anneedeproduction.setText("");
                note.setText("");
                Alert alert = new Alert(Alert.AlertType.INFORMATION);
                alert.setTitle("Alerte");
                alert.setHeaderText(null);
                alert.setContentText("Erreur d'insertion !");
                alert.showAndWait();
            }
            else {
     
             requeteRecherche = "select * from productions where 1=1 ";
     
            if(!Titre.isEmpty()) {
                requeteRecherche += "and titre like '"+Titre+"%'";
            }
            if(!Interpreterealisateur.isEmpty()) {
                requeteRecherche += "and interpreterealisateur like '"+Interpreterealisateur+"%'";
            }
            if("Musique".equals(Type) || "Film".equals(Type)) {
                requeteRecherche += "and type like '"+Type+"%'";
            }
            if(!anneeProduction.isEmpty()) {
                requeteRecherche += "and annee_production like '"+anneeProduction+"%'";
            }
            if(!Note.isEmpty()) {
                requeteRecherche += "and note like '"+Note+"%'";
            }
     
            try {
                stmtListe = (Statement) maConnexion.ObtenirConnection().createStatement();
                ResultSet rs = stmtListe.executeQuery(requeteRecherche);
     
                while(rs.next()) {
                    ObservableList<String> row = FXCollections.observableArrayList();
                    for(int i=1 ; i<=rs.getMetaData().getColumnCount(); i++){
                        row.add(rs.getString(i));
                    }
                    data.add(row);
                    nbResultats++;
                }
                tableprod.setItems(data);
     
                titreColumn.setCellValueFactory(feature -> {
                final ObservableList list = feature.getValue(); 
                final String title = (String)list.get(1);
                return new SimpleStringProperty(title);
                 });
     
                interpreterealisateurColumn.setCellValueFactory(feature -> {
                final ObservableList list = feature.getValue(); 
                final String title = (String)list.get(2);
                return new SimpleStringProperty(title);
                 });
     
                typeColumn.setCellValueFactory(feature -> {
                final ObservableList list = feature.getValue(); 
                final String title = (String)list.get(3);
                return new SimpleStringProperty(title);
                 });
     
                anneeprodColumn.setCellValueFactory(feature -> {
                final ObservableList list = feature.getValue(); 
                final String title = (String)list.get(4);
                return new SimpleStringProperty(title);
                 });
     
                noteColumn.setCellValueFactory(feature -> {
                final ObservableList list = feature.getValue(); 
                final String title = (String)list.get(5);
                return new SimpleStringProperty(title);
                });
     
            }
            catch(SQLException ex) {
                System.out.println(ex);
            }
     
            System.out.println(nbResultats);
     
            if(nbResultats==0) {
                nbresult.setText("");
                titre.setText("");
                interpreterealisateur.setText("");
                type.setValue("Type");
                anneedeproduction.setText("");
                note.setText("");
                Alert alert = new Alert(Alert.AlertType.INFORMATION);
                alert.setTitle("Alerte");
                alert.setHeaderText(null);
                alert.setContentText("Aucun résultat !");
                alert.showAndWait();
            }
            else {
            if(nbResultats == 1) nbresult.setText(nbResultats + " résultat");
            else nbresult.setText(nbResultats + " résultats");
            }
          }
        }
    }
    Quand je remplis les champs avec des valeurs qui ne trouveront aucun résultat dans ma BDD, j'ai bien le message correspondant qui s'affiche lorsque je clique sur le bouton, donc c'est OK. Par contre, avec des valeurs qui devraient me trouver des résultats, rien de s'affiche dans ma TableView et j'ai toutes ces erreurs :
    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
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
     
    Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    	at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1774)
    	at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)
    	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    	at javafx.event.Event.fireEvent(Event.java:198)
    	at javafx.scene.Node.fireEvent(Node.java:8413)
    	at javafx.scene.control.Button.fire(Button.java:185)
    	at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
    	at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
    	at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
    	at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
    	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
    	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    	at javafx.event.Event.fireEvent(Event.java:198)
    	at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
    	at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
    	at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
    	at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
    	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
    	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
    	at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
    	at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
    	at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
    	at com.sun.glass.ui.View.notifyMouse(View.java:937)
    	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    	at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
    	at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.reflect.InvocationTargetException
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
    	at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
    	at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1769)
    	... 48 more
    Caused by: java.lang.NullPointerException
    	at ControllerRechercherView.BtnOnClick(ControllerRechercherView.java:162)
    	... 58 more
    Merci beaucoup pour votre aide!

  2. #2
    Rédacteur/Modérateur

    Avatar de bouye
    Homme Profil pro
    Information Technologies Specialist (Scientific Computing)
    Inscrit en
    Août 2005
    Messages
    6 901
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Nouvelle-Calédonie

    Informations professionnelles :
    Activité : Information Technologies Specialist (Scientific Computing)
    Secteur : Agroalimentaire - Agriculture

    Informations forums :
    Inscription : Août 2005
    Messages : 6 901
    Billets dans le blog
    54
    Par défaut
    La trace t'indique bien que tu as une série d'exception en cascade qui est causée initialement par une valeur null a la ligne 162 de la classe ControllerRechercherView
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    [...]
    Caused by: java.lang.reflect.InvocationTargetException
    [...]
    Caused by: java.lang.NullPointerException
    	at ControllerRechercherView.BtnOnClick(ControllerRechercherView.java:162)
    Il serait peut-être bon d'y passer avec le deboggeur ou de savoir ce que fait cette ligne.
    Merci de penser au tag quand une réponse a été apportée à votre question. Aucune réponse ne sera donnée à des messages privés portant sur des questions d'ordre technique. Les forums sont là pour que vous y postiez publiquement vos problèmes.

    suivez mon blog sur Développez.

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning. ~ Rich Cook

  3. #3
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2018
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2018
    Messages : 15
    Par défaut
    Ok, c'est réglé, merci beaucoup. Par contre il n'y a toujours rien qui ne s'affiche dans ma TableView...
    Je peux voir qu'au niveau de la recherche c'est ok car après de multiples tests, le nombre de résultat dans le label en bas à gauche est toujours correct.
    Nom : rech.PNG
Affichages : 864
Taille : 21,0 Ko
    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
    <?xml version="1.0" encoding="UTF-8"?>
     
    <?import javafx.scene.control.Button?>
    <?import javafx.scene.control.ComboBox?>
    <?import javafx.scene.control.Label?>
    <?import javafx.scene.control.TableColumn?>
    <?import javafx.scene.control.TableView?>
    <?import javafx.scene.control.TextField?>
    <?import javafx.scene.layout.AnchorPane?>
     
     
    <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="535.0" prefWidth="992.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ControllerRechercherView">
       <children>
          <Label layoutX="14.0" layoutY="24.0" prefHeight="18.0" prefWidth="174.0" text="Titre" />
          <Label layoutX="14.0" layoutY="98.0" prefHeight="18.0" prefWidth="174.0" text="Interprète / Réalisateur" />
          <Label layoutX="14.0" layoutY="172.0" prefHeight="18.0" prefWidth="174.0" text="Type" />
          <Label layoutX="14.0" layoutY="252.0" prefHeight="18.0" prefWidth="174.0" text="Année de productions" />
          <Label layoutX="14.0" layoutY="326.0" prefHeight="18.0" prefWidth="174.0" text="Note ( /5)" />
          <TextField fx:id="titre" layoutX="14.0" layoutY="54.0" promptText="Titre" />
          <TextField fx:id="interpreterealisateur" layoutX="14.0" layoutY="127.0" promptText="Interprète / Réalisateur" />
          <ComboBox fx:id="type" layoutX="14.0" layoutY="200.0" prefHeight="26.0" prefWidth="189.0" promptText="Type" />
          <TextField fx:id="anneedeproduction" layoutX="14.0" layoutY="279.0" promptText="Année de production" />
          <TextField fx:id="note" layoutX="14.0" layoutY="353.0" promptText="Note ( /5)" />
          <Button layoutX="13.0" layoutY="447.0" mnemonicParsing="false" onAction="#BtnOnClick" prefHeight="39.0" prefWidth="190.0" text="Rechercher" />
          <Label fx:id="nbresult" layoutX="750.0" layoutY="504.0" prefHeight="18.0" prefWidth="174.0" />
          <TableView fx:id="tableprod" layoutX="218.0" layoutY="26.0" prefHeight="474.0" prefWidth="759.0">
             <columns>
                <TableColumn fx:id="titreColumn" prefWidth="154.39998817443848" text="Titre" />
                <TableColumn fx:id="interpreterealisateurColumn" prefWidth="177.60003662109375" text="Interprète / Réalisateur" />
                <TableColumn fx:id="typeColumn" prefWidth="121.5999755859375" text="Type" />
                <TableColumn fx:id="anneeprodColumn" prefWidth="200.79998779296875" text="Année de production" />
                <TableColumn fx:id="noteColumn" prefWidth="83.19992675781248" text="Note ( /5)" />
             </columns>
          </TableView>
       </children>
    </AnchorPane>
    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
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
     
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Calendar;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.collections.transformation.FilteredList;
    import javafx.collections.transformation.SortedList;
    import javafx.event.ActionEvent;
    import javafx.fxml.FXML;
    import javafx.scene.control.Alert;
    import javafx.scene.control.ComboBox;
    import javafx.scene.control.Label;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.TextField;
     
    /*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
     
    /**
     *
     * @author Thibault Dereumaux
     */
    public class ControllerRechercherView {
     
        @FXML
        private TableView tableprod;
     
        @FXML
        private TextField titre;
     
        @FXML
        private TextField interpreterealisateur;
     
        @FXML
        private ComboBox<String> type;
     
        @FXML
        private TextField anneedeproduction;
     
        @FXML
        private TextField note;
     
        @FXML
        private Label nbresult;
     
     
        @FXML
        public void initialize() {
            type.getItems().removeAll(type.getItems());
            type.getItems().addAll("Musique", "Film");
            nbresult.setText("");
            titre.setText("");
            interpreterealisateur.setText("");
            anneedeproduction.setText("");
            note.setText("");
            tableprod.refresh();
        }
     
        @FXML
        private TableColumn<ObservableList, String> titreColumn;
     
        @FXML
        private TableColumn<ObservableList, String> interpreterealisateurColumn;
     
        @FXML
        private TableColumn<ObservableList, String> typeColumn;
     
        @FXML
        private TableColumn<ObservableList, String> anneeprodColumn;
     
        @FXML
        private TableColumn<ObservableList, String> noteColumn;
     
        ObservableList<String> data=FXCollections.observableArrayList();
        FilteredList<String> filteredData=new FilteredList<>(data,e->true);
     
        Statement stmtListe;
        Connexion maConnexion = new Connexion();
     
        @FXML
        void BtnOnClick(ActionEvent event) {
     
            String Titre = titre.getText();
            String Interpreterealisateur = interpreterealisateur.getText();
            String Type = (String)type.getValue();
            String anneeProduction = anneedeproduction.getText();
            String Note = note.getText();
            System.out.println(Type);
            String requeteRecherche;
            int noteInt = 0;
            int anneeProductionInt = 0;
            boolean FormatOk = true;
            int nbResultats = 0;
     
            Calendar c = Calendar.getInstance();
     
            if(!Note.isEmpty()) {
                try {
                noteInt = Integer.decode(Note);
                }
                catch (NumberFormatException ex) {
                System.err.println(ex);
                FormatOk = false;
                }
            }
     
            if(!anneeProduction.isEmpty()) {
                try {
                anneeProductionInt = Integer.decode(anneeProduction);
                }
                catch (NumberFormatException ex) {
                System.err.println(ex);
                FormatOk = false;
                }
            }
     
            if((noteInt < 0 || noteInt > 5 || anneeProductionInt > c.get(Calendar.YEAR) || anneeProductionInt < -1500) && (!Note.isEmpty() || !anneeProduction.isEmpty())) {
                FormatOk = false;
            }
     
            if (FormatOk == false) {
                initialize();
                Alert alert = new Alert(Alert.AlertType.INFORMATION);
                alert.setTitle("Alerte");
                alert.setHeaderText(null);
                alert.setContentText("Erreur d'insertion !");
                alert.showAndWait();
            }
            else {
     
             requeteRecherche = "select * from productions where 1=1 ";
     
            if(!Titre.isEmpty()) {
                requeteRecherche += "and titre like '"+Titre+"%'";
            }
            if(!Interpreterealisateur.isEmpty()) {
                requeteRecherche += "and interpreterealisateur like '"+Interpreterealisateur+"%'";
            }
            if("Musique".equals(Type) || "Film".equals(Type)) {
                requeteRecherche += "and type like '"+Type+"%'";
            }
            if(!anneeProduction.isEmpty()) {
                requeteRecherche += "and annee_production like '"+anneeProduction+"%'";
            }
            if(!Note.isEmpty()) {
                requeteRecherche += "and note like '"+Note+"%'";
            }
     
            try {
                stmtListe = (Statement) maConnexion.ObtenirConnection().createStatement();
                ResultSet rs = stmtListe.executeQuery(requeteRecherche);
                System.out.println(requeteRecherche);
                while(rs.next()) {
                    ObservableList<String> row = FXCollections.observableArrayList();
                    for(int i=1 ; i<=rs.getMetaData().getColumnCount(); i++){
                        row.add(rs.getString(i));
                    }
                    SortedList<String> sortedData=new SortedList<>(filteredData);
                    sortedData.comparatorProperty().bind(tableprod.comparatorProperty());
                    tableprod.setItems(sortedData);
                    nbResultats++;
                }
     
                titreColumn.setCellValueFactory(feature -> {
                final ObservableList list = feature.getValue(); 
                final String title = (String)list.get(1);
                return new SimpleStringProperty(title);
                 });
     
                interpreterealisateurColumn.setCellValueFactory(feature -> {
                final ObservableList list = feature.getValue(); 
                final String title = (String)list.get(2);
                return new SimpleStringProperty(title);
                 });
     
                typeColumn.setCellValueFactory(feature -> {
                final ObservableList list = feature.getValue(); 
                final String title = (String)list.get(3);
                return new SimpleStringProperty(title);
                 });
     
                anneeprodColumn.setCellValueFactory(feature -> {
                final ObservableList list = feature.getValue(); 
                final String title = (String)list.get(4);
                return new SimpleStringProperty(title);
                 });
     
                noteColumn.setCellValueFactory(feature -> {
                final ObservableList list = feature.getValue(); 
                final String title = (String)list.get(5);
                return new SimpleStringProperty(title);
                });
     
            }
            catch(SQLException ex) {
                System.out.println(ex);
            }
     
            System.out.println(nbResultats);
     
            if(nbResultats==0) {
                initialize();
                Alert alert = new Alert(Alert.AlertType.INFORMATION);
                alert.setTitle("Alerte");
                alert.setHeaderText(null);
                alert.setContentText("Aucun résultat !");
                alert.showAndWait();
            }
            else {
            if(nbResultats == 1) nbresult.setText(nbResultats + " résultat");
            else nbresult.setText(nbResultats + " résultats");
            }
          }
        }
    }
    Je tiens à préciser qu'à la base l'application était en swing et fonctionnait correctement et donc là je dois la refaire en javafx, je ne capte pas trop le soucis...
    Merci beaucoup pour l'aide!!

    EDIT: Je n'ai aucune erreur

  4. #4
    Rédacteur/Modérateur

    Avatar de bouye
    Homme Profil pro
    Information Technologies Specialist (Scientific Computing)
    Inscrit en
    Août 2005
    Messages
    6 901
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Nouvelle-Calédonie

    Informations professionnelles :
    Activité : Information Technologies Specialist (Scientific Computing)
    Secteur : Agroalimentaire - Agriculture

    Informations forums :
    Inscription : Août 2005
    Messages : 6 901
    Billets dans le blog
    54
    Par défaut
    Ici la table indique bien qu'il n'y a aucun contenu donc cela veut dire aucune ligne à afficher (indépendamment de la fabrique à valeur) et donc que sa liste items est vide. Vérifie ce qu'il se passe aux divers endroits où tu fais tableprod.setItems(...) par exemple si la liste triée sortedData contient bien quelque chose ou s'il te manque un appel quelque part.
    Merci de penser au tag quand une réponse a été apportée à votre question. Aucune réponse ne sera donnée à des messages privés portant sur des questions d'ordre technique. Les forums sont là pour que vous y postiez publiquement vos problèmes.

    suivez mon blog sur Développez.

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning. ~ Rich Cook

  5. #5
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2018
    Messages
    15
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2018
    Messages : 15
    Par défaut
    Après quelques modifications suivant tes conseils ...
    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
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
     
     
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Calendar;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.collections.transformation.SortedList;
    import javafx.event.ActionEvent;
    import javafx.fxml.FXML;
    import javafx.scene.control.Alert;
    import javafx.scene.control.ComboBox;
    import javafx.scene.control.Label;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.TextField;
     
    /*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
     
    /**
     *
     * @author Thibault Dereumaux
     */
    public class ControllerRechercherView {
     
        @FXML
        private TableView tableprod;
     
        @FXML
        private TextField titre;
     
        @FXML
        private TextField interpreterealisateur;
     
        @FXML
        private ComboBox<String> type;
     
        @FXML
        private TextField anneedeproduction;
     
        @FXML
        private TextField note;
     
        @FXML
        private Label nbresult;
     
     
        @FXML
        public void initialize() {
            type.getItems().removeAll(type.getItems());
            type.getItems().addAll("Musique", "Film");
            nbresult.setText("");
            titre.setText("");
            interpreterealisateur.setText("");
            anneedeproduction.setText("");
            note.setText("");
            tableprod.refresh();
        }
     
        @FXML
        private TableColumn<ObservableList, String> titreColumn;
     
        @FXML
        private TableColumn<ObservableList, String> interpreterealisateurColumn;
     
        @FXML
        private TableColumn<ObservableList, String> typeColumn;
     
        @FXML
        private TableColumn<ObservableList, String> anneeprodColumn;
     
        @FXML
        private TableColumn<ObservableList, String> noteColumn;
     
        Statement stmtListe;
        Connexion maConnexion = new Connexion();
     
        @FXML
        void BtnOnClick(ActionEvent event) {
     
            String Titre = titre.getText();
            String Interpreterealisateur = interpreterealisateur.getText();
            String Type = (String)type.getValue();
            String anneeProduction = anneedeproduction.getText();
            String Note = note.getText();
            System.out.println("Type : " + Type);
            String requeteRecherche;
            int noteInt = 0;
            int anneeProductionInt = 0;
            boolean FormatOk = true;
            int nbResultats = 0;
     
            Calendar c = Calendar.getInstance();
     
            if(!Note.isEmpty()) {
                try {
                noteInt = Integer.decode(Note);
                }
                catch (NumberFormatException ex) {
                System.err.println(ex);
                FormatOk = false;
                }
            }
     
            if(!anneeProduction.isEmpty()) {
                try {
                anneeProductionInt = Integer.decode(anneeProduction);
                }
                catch (NumberFormatException ex) {
                System.err.println(ex);
                FormatOk = false;
                }
            }
     
            if((noteInt < 0 || noteInt > 5 || anneeProductionInt > c.get(Calendar.YEAR) || anneeProductionInt < -1500) && (!Note.isEmpty() || !anneeProduction.isEmpty())) {
                FormatOk = false;
            }
     
            if (FormatOk == false) {
                initialize();
                Alert alert = new Alert(Alert.AlertType.INFORMATION);
                alert.setTitle("Alerte");
                alert.setHeaderText(null);
                alert.setContentText("Erreur d'insertion !");
                alert.showAndWait();
            }
            else {
     
             requeteRecherche = "select * from productions where 1=1 ";
     
            if(!Titre.isEmpty()) {
                requeteRecherche += "and titre like '"+Titre+"%'";
            }
            if(!Interpreterealisateur.isEmpty()) {
                requeteRecherche += "and interpreterealisateur like '"+Interpreterealisateur+"%'";
            }
            if("Musique".equals(Type) || "Film".equals(Type)) {
                requeteRecherche += "and type like '"+Type+"%'";
            }
            if(!anneeProduction.isEmpty()) {
                requeteRecherche += "and annee_production like '"+anneeProduction+"%'";
            }
            if(!Note.isEmpty()) {
                requeteRecherche += "and note like '"+Note+"%'";
            }
     
            try {
                stmtListe = (Statement) maConnexion.ObtenirConnection().createStatement();
                ResultSet rs = stmtListe.executeQuery(requeteRecherche);
                System.out.println(requeteRecherche);
                while(rs.next()) {
                    ObservableList<String> row = FXCollections.observableArrayList();
                    for(int i=1 ; i<=rs.getMetaData().getColumnCount(); i++){
                        row.add(rs.getString(i));
                    }
                    ObservableList<String> sortedData=new SortedList<>(row);
                    System.out.println("sortedData " + nbResultats + " : " + sortedData);
                    tableprod.setItems(sortedData);
                    nbResultats++;
                }
     
                titreColumn.setCellValueFactory(feature -> {
                final ObservableList list = feature.getValue(); 
                final String title = (String)list.get(1);
                return new SimpleStringProperty(title);
                 });
     
                interpreterealisateurColumn.setCellValueFactory(feature -> {
                final ObservableList list = feature.getValue(); 
                final String title = (String)list.get(2);
                return new SimpleStringProperty(title);
                 });
     
                typeColumn.setCellValueFactory(feature -> {
                final ObservableList list = feature.getValue(); 
                final String title = (String)list.get(3);
                return new SimpleStringProperty(title);
                 });
     
                anneeprodColumn.setCellValueFactory(feature -> {
                final ObservableList list = feature.getValue(); 
                final String title = (String)list.get(4);
                return new SimpleStringProperty(title);
                 });
     
                noteColumn.setCellValueFactory(feature -> {
                final ObservableList list = feature.getValue(); 
                final String title = (String)list.get(5);
                return new SimpleStringProperty(title);
                });
     
            }
            catch(SQLException ex) {
                System.out.println(ex);
            }
     
            System.out.println("Nombre de résultat(s) : " + nbResultats);
     
            if(nbResultats==0) {
                initialize();
                Alert alert = new Alert(Alert.AlertType.INFORMATION);
                alert.setTitle("Alerte");
                alert.setHeaderText(null);
                alert.setContentText("Aucun résultat !");
                alert.showAndWait();
            }
            else {
            if(nbResultats == 1) nbresult.setText(nbResultats + " résultat");
            else nbresult.setText(nbResultats + " résultats");
            }
          }
        }
    }
    Screen de la fenêtre juste après la recherche ...
    Nom : screenAfterRech.PNG
Affichages : 854
Taille : 20,3 Ko
    La Table n'affiche plus "aucun résultat" mais rien ne s'affiche, pas même les lignes
    Et voici l'output pour une recherche par laquelle la BDD va me retourner 3 résultats ...
    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
     
    run:
    juil. 28, 2018 3:50:52 PM javafx.fxml.FXMLLoader$ValueElement processValue
    WARNING: Loading FXML document with JavaFX API of version 10.0.1 by JavaFX runtime of version 8.0.161
    Chargement du pilote OK
    Connexion à la BDD OK
    juil. 28, 2018 3:50:54 PM javafx.fxml.FXMLLoader$ValueElement processValue
    WARNING: Loading FXML document with JavaFX API of version 10.0.1 by JavaFX runtime of version 8.0.161
    Type : null
    select * from productions where 1=1 and note like '2%'
    sortedData 0 : [9, Let it be, The Beatles, Musique, 1970, 2]
    sortedData 1 : [28, Cobain, Nanouk Leopold, Film, 2018, 2]
    sortedData 2 : [31, Plus Tard, 47Ter, Musique, 2018, 2]
    Nombre de résultat(s) : 3
    Exception in thread "JavaFX Application Thread" java.lang.ClassCastException: java.lang.String cannot be cast to javafx.collections.ObservableList
    	at ControllerRechercherView.lambda$BtnOnClick$0(ControllerRechercherView.java:168)
    	at javafx.scene.control.TableColumn.getCellObservableValue(TableColumn.java:578)
    	at javafx.scene.control.TableColumn.getCellObservableValue(TableColumn.java:563)
    	at javafx.scene.control.TableCell.updateItem(TableCell.java:644)
    	at javafx.scene.control.TableCell.indexChanged(TableCell.java:468)
    	at javafx.scene.control.IndexedCell.updateIndex(IndexedCell.java:116)
    	at com.sun.javafx.scene.control.skin.TableRowSkinBase.updateCells(TableRowSkinBase.java:533)
    	at com.sun.javafx.scene.control.skin.TableRowSkinBase.init(TableRowSkinBase.java:147)
    	at com.sun.javafx.scene.control.skin.TableRowSkin.<init>(TableRowSkin.java:64)
    	at javafx.scene.control.TableRow.createDefaultSkin(TableRow.java:212)
    	at javafx.scene.control.Control.impl_processCSS(Control.java:872)
    	at javafx.scene.Node.processCSS(Node.java:9058)
    	at javafx.scene.Node.applyCss(Node.java:9155)
    	at com.sun.javafx.scene.control.skin.VirtualFlow.setCellIndex(VirtualFlow.java:1964)
    	at com.sun.javafx.scene.control.skin.VirtualFlow.getCell(VirtualFlow.java:1797)
    	at com.sun.javafx.scene.control.skin.VirtualFlow.getCellLength(VirtualFlow.java:1879)
    	at com.sun.javafx.scene.control.skin.VirtualFlow.computeViewportOffset(VirtualFlow.java:2528)
    	at com.sun.javafx.scene.control.skin.VirtualFlow.layoutChildren(VirtualFlow.java:1189)
    	at javafx.scene.Parent.layout(Parent.java:1087)
    	at javafx.scene.Parent.layout(Parent.java:1093)
    	at javafx.scene.Parent.layout(Parent.java:1093)
    	at javafx.scene.Scene.doLayoutPass(Scene.java:552)
    	at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2397)
    	at com.sun.javafx.tk.Toolkit.lambda$runPulse$29(Toolkit.java:398)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:397)
    	at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:424)
    	at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:518)
    	at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:498)
    	at com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:491)
    	at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$403(QuantumToolkit.java:319)
    	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    	at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
    	at java.lang.Thread.run(Thread.java:748)
    BUILD SUCCESSFUL (total time: 15 seconds)
    J'ai donc visiblement un soucis un niveau de mes lambdas qui permettent de remplir justement ma TableView et je n'y ai toujours pas trouvé de solutions

    Encore un grand merci pour l'aide qui m'a déjà permit d'avancé dans mon soucis !

  6. #6
    Rédacteur/Modérateur

    Avatar de bouye
    Homme Profil pro
    Information Technologies Specialist (Scientific Computing)
    Inscrit en
    Août 2005
    Messages
    6 901
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Nouvelle-Calédonie

    Informations professionnelles :
    Activité : Information Technologies Specialist (Scientific Computing)
    Secteur : Agroalimentaire - Agriculture

    Informations forums :
    Inscription : Août 2005
    Messages : 6 901
    Billets dans le blog
    54
    Par défaut
    Il semble que tu ais changé le type des données contenu dans la table, précédemment, pour chaque ligne de la table, tu avais des ObservableList, tandis que désormais tu semble avoir des String (à l’endroit ou tu as un onMouseClicked) d'ou le ClassCastException.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Exception in thread "JavaFX Application Thread" java.lang.ClassCastException: java.lang.String cannot be cast to javafx.collections.ObservableList
    	at ControllerRechercherView.lambda$BtnOnClick$0(ControllerRechercherView.java:168)
    Merci de penser au tag quand une réponse a été apportée à votre question. Aucune réponse ne sera donnée à des messages privés portant sur des questions d'ordre technique. Les forums sont là pour que vous y postiez publiquement vos problèmes.

    suivez mon blog sur Développez.

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning. ~ Rich Cook

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. ASM + DELPHI ... soucis ... mais top intéressant !
    Par - Robby - dans le forum Langage
    Réponses: 9
    Dernier message: 21/11/2003, 15h58
  2. [langage] ptit souci de syntaxe
    Par marouanitos dans le forum Langage
    Réponses: 2
    Dernier message: 26/09/2003, 10h28
  3. [File et Directory ListBox] Soucis de filtre
    Par Mercilius dans le forum Composants VCL
    Réponses: 8
    Dernier message: 04/04/2003, 16h17
  4. Réponses: 4
    Dernier message: 16/02/2003, 12h16
  5. Réponses: 2
    Dernier message: 03/10/2002, 17h24

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo