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

Agents de placement/Fenêtres Java Discussion :

Fenetre affichee vide / composants non visibles


Sujet :

Agents de placement/Fenêtres Java

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Décembre 2007
    Messages
    53
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2007
    Messages : 53
    Points : 24
    Points
    24
    Par défaut Fenetre affichee vide / composants non visibles
    Bonjour,

    J ai un probleme d affichage d une Jdialog tres basique d affichage d erreur. Elle apparait des fois comme vide: elle est bien adaptee en fonction des composants dedans, mais tous l interieur de la fenetre est vide.

    Et cela ne m arrive pas a tous les coups !!!
    Quand cela arrive, je peux alors deplacer la fenetre, mais pas la fermer.

    J avais ce probleme avec un de mes utilisateurs sous Windows, et depuis recemment, j ai le meme probleme sous Linux (Je n ai pas fait d update qui pourrait en etre la cause).

    J avais trouve un message relatant un probleme comme celui ci sous Windows a cause d une incompatibilite java (je n ai pas teste si ca venait bien de la pour mon utilisateur sous Windows), mais sous Linux ???

    D ou cela pourrait il venir a votre avis?

    Merci

    PS: je ne modifie pas les setVisible(), ou autres choses similaires...

  2. #2
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Points : 48 807
    Points
    48 807
    Par défaut
    Sous linux, çà m'arrive assez régulièrement, çà proviens d'un problème de compatibilité avec les extensions xgl, compiz et assimilé. Certaines distros incluent d'ailleurs des règles pour désactiver les effets sur les fenetres java.

    Donc pour ton linux, vérifie si les effets de bureau sont actifs et , si oui, vite les.

    Note que c'est aléatoire (la meme fenetre parfois foire, parfois pas) et est, visiblement, liée à la gestion des ressources graphiques dans certaines conditions. (Bug nvidia?)

  3. #3
    Membre à l'essai
    Profil pro
    Inscrit en
    Décembre 2007
    Messages
    53
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2007
    Messages : 53
    Points : 24
    Points
    24
    Par défaut
    Merci pour ta reponse,

    Le Linux que j ai n a pas beaucoup d effets graphiques (ordi a mon boulot), et encore moins compiz (enfin il me semble).
    (Mon Linux est un Centos)

    J ai cet effet que tu me decris sur un autre PC a la maison, mais la ca semble etre different:
    Le fait est que ca ne m arrivait pas du tout avant, et que maintenant ca m arrive presque une fois sur 2 que j appelle cette fenetre donnee (et seulement celle la), et j ai le meme phenomene avec la meme fenetre sous Windows.

    Ca me parait tres bizarre ...

  4. #4
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Points : 48 807
    Points
    48 807
    Par défaut
    que tu aie le meme problème sur la meme fenetre sous windows est bizzare en effet. As-tu des erreurs éventuellement dans la console?

  5. #5
    Membre à l'essai
    Profil pro
    Inscrit en
    Décembre 2007
    Messages
    53
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2007
    Messages : 53
    Points : 24
    Points
    24
    Par défaut
    As-tu des erreurs éventuellement dans la console?
    La fenetre qui fait ca est une fenetre qui permet d afficher les erreurs quand elles surviennent, mais a part l erreur qui a cause l ouverture de la fenetre, je n ai pas d erreur directement liee a laffichage/ouverture de cette fenetre.

    Et c est pour ca que je ne comprend rien

  6. #6
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Points : 48 807
    Points
    48 807
    Par défaut
    tu utilise quoi, un JOptionPane pour l'affichage?

  7. #7
    Membre à l'essai
    Profil pro
    Inscrit en
    Décembre 2007
    Messages
    53
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2007
    Messages : 53
    Points : 24
    Points
    24
    Par défaut
    tu utilise quoi, un JOptionPane pour l'affichage?
    j utilise un jDialog

    Voici une partie du code (Netbeans):
    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
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
     
    public class ErrorDialog extends javax.swing.JDialog implements ActionListener {
        private static final long serialVersionUID = 1L;
        private boolean details = true;
     
        /** Creates new form BeanForm */
        public ErrorDialog(String message, String details1, StackTraceElement[] details2) {
            initComponents();
     
            jButton1.addActionListener(this);
            jButton2.addActionListener(this);
            jButton3.addActionListener(this);
     
            if (details2 != null) {
                this.dialogVisible(message, details1, details2);
            } else {
                this.dialogVisible(message, details1);
            }
        }
     
        public static void display(String message, String details1, StackTraceElement[] details2) {
            ErrorDialog dialog = new ErrorDialog(message, details1, details2);
     
            UserPreferences.setLocationRelativeToDefaultFrame(dialog);
            dialog.setVisible(true);
        }
     
        public static void display(String message, String details) {
            ErrorDialog dialog = new ErrorDialog(message, details, null);
     
            UserPreferences.setLocationRelativeToDefaultFrame(dialog);
            dialog.setVisible(true);
        }
     
        private void dialogVisible(String message, String details1, StackTraceElement[] details2) {
            dialogVisible(message, details1);
     
            // creation of details
            String det = details1 + Files.NEWLINE + Files.NEWLINE;
            for (int i = 0; i < details2.length; i++) {
                det += details2[i].toString() + Files.NEWLINE;
            }
     
            // change the text
            this.jTextArea1.setText(det);
        }
     
        private void dialogVisible(String message, String details) {
            // change the text
            this.jTextArea2.setText(message);
            this.jTextArea2.setCaretPosition(0);
            this.jTextArea1.setText(details);
     
            // display without the details
            this.hideDetails();
        }
     
        private void displayDetails() {
            // if the details are not hidden
            if (this.details == false) {
                // modifie les elements de la boite de dialogue
                this.jButton3.setText("Details <<");
                this.jButton3.setToolTipText("Hide details");
     
                // show the dialog box
                jLabel2.setVisible(true);
                jScrollPane1.setVisible(true);
                jTextArea1.setVisible(true);
                this.validate();
                this.pack();
     
                // change the state
                this.details = true;
            }
        }
     
        private void hideDetails() {
            // if the details are not hidden
            if (this.details == true) {
                // modify the elements of the dialog box
                this.jButton3.setText("Details >>");
                this.jButton3.setToolTipText("Display details");
     
                // put off the details
                jLabel2.setVisible(false);
                jScrollPane1.setVisible(false);
                jTextArea1.setVisible(false);
     
                // modifie la boite de dialogue
                this.validate();
                this.pack();
     
                // change the state
                this.details = false;
            }
        }
     
        private void saveError() throws IOException {
            GenericFileChooser fc = UserPreferences.getDefaultFileChooser();
            fc.setFilterTXT();
     
            if (fc.showSaveDialog(this) == GenericFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                file = fc.getFileWithExtension(file, GenericFileChooser.ExtensionTXT);
                if (!fc.recordFile(this, file)) {
                    return;
                }
     
                FlowWrite flow = null;
                try {
                    flow = new FlowWrite(file);
                    flow.write(jTextArea1.getText());
                } finally {
                    flow.close();
                }
            }
        }
     
        @Override
        public void actionPerformed(ActionEvent evt) {
            // close button
            if (evt.getActionCommand().equals("close")) {
                this.dispose();
            }
     
            // save button
            if (evt.getActionCommand().equals("saveError")) {
                try {
                    saveError();
                } catch (IOException ex) {
                    ExceptionSending.display(ex);
                }
            }
     
            // details button
            if (evt.getActionCommand().equals("details")) {
                if (this.details == true) {
                    this.hideDetails();
                } else {
                    this.displayDetails();
                }
            }
        }
     
        private void initComponents() {
     
            jLabel1 = new javax.swing.JLabel();
            jButton2 = new javax.swing.JButton();
            jButton3 = new javax.swing.JButton();
            jLabel2 = new javax.swing.JLabel();
            jScrollPane1 = new javax.swing.JScrollPane();
            jTextArea1 = new javax.swing.JTextArea();
            jButton1 = new javax.swing.JButton();
            jScrollPane2 = new javax.swing.JScrollPane();
            jTextArea2 = new javax.swing.JTextArea();
     
            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            setTitle("Error");
            setModal(true);
     
            jLabel1.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
            jLabel1.setName("jLabel1"); // NOI18N
     
            jButton2.setText("Save Error");
            jButton2.setToolTipText("Save the error for degugging");
            jButton2.setActionCommand("saveError");
            jButton2.setMargin(new java.awt.Insets(1, 7, 1, 7));
            jButton2.setName("jButton2"); // NOI18N
     
            jButton3.setText("Details >>");
            jButton3.setToolTipText("Display details");
            jButton3.setActionCommand("details");
            jButton3.setMargin(new java.awt.Insets(1, 7, 1, 7));
            jButton3.setName("jButton3"); // NOI18N
     
            jLabel2.setText("Error details:");
            jLabel2.setName("jLabel2"); // NOI18N
     
            jScrollPane1.setName("jScrollPane1"); // NOI18N
     
            jTextArea1.setColumns(20);
            jTextArea1.setForeground(new java.awt.Color(255, 0, 0));
            jTextArea1.setRows(5);
            jTextArea1.setName("jTextArea1"); // NOI18N
            jScrollPane1.setViewportView(jTextArea1);
     
            jButton1.setText("Close");
            jButton1.setToolTipText("Close the window");
            jButton1.setActionCommand("close");
            jButton1.setName("jButton1"); // NOI18N
     
            jScrollPane2.setBackground(java.awt.SystemColor.window);
            jScrollPane2.setBorder(null);
            jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            jScrollPane2.setName("jScrollPane2"); // NOI18N
            jScrollPane2.setOpaque(false);
     
            jTextArea2.setBackground(java.awt.SystemColor.window);
            jTextArea2.setColumns(20);
            jTextArea2.setEditable(false);
            jTextArea2.setLineWrap(true);
            jTextArea2.setRows(5);
            jTextArea2.setWrapStyleWord(true);
            jTextArea2.setBorder(null);
            jTextArea2.setName("jTextArea2"); // NOI18N
            jTextArea2.setOpaque(false);
            jScrollPane2.setViewportView(jTextArea2);
     
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE))
                                .addComponent(jLabel2))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jButton3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                    .addContainerGap())
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jButton1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jButton2)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jButton3))
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
                    .addComponent(jLabel2)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
                    .addContainerGap())
            );
     
            layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jButton1, jButton2, jButton3});
     
        }                       
        // Variables declaration                  
        private javax.swing.JButton jButton1;
        private javax.swing.JButton jButton2;
        private javax.swing.JButton jButton3;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JScrollPane jScrollPane2;
        private javax.swing.JTextArea jTextArea1;
        private javax.swing.JTextArea jTextArea2;
        // End of variables declaration                   
    }

  8. #8
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Points : 48 807
    Points
    48 807
    Par défaut
    mis à part l'illisibilité du layout, je vois pas. T'as essayé avec des jvm différentes?

  9. #9
    Membre à l'essai
    Profil pro
    Inscrit en
    Décembre 2007
    Messages
    53
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2007
    Messages : 53
    Points : 24
    Points
    24
    Par défaut
    mis à part l'illisibilité du layout
    Je suis bien d accord
    Mais comme mon programme est essentiallement graphique, et que je dois le faire evoluer souvent, ca aide bien !!!

    T'as essayé avec des jvm différentes?
    Comme j ai des elements propres au Java 1.6, je n ai pas pu. Mais je vais essayer...

Discussions similaires

  1. Evènement d'un sous-composant non visible
    Par guillemouze dans le forum Composants VCL
    Réponses: 2
    Dernier message: 03/04/2013, 11h47
  2. Capture d'évênement clavier par un composant non visible
    Par _Ulysse_ dans le forum Windows Forms
    Réponses: 5
    Dernier message: 21/05/2012, 16h14
  3. GridView vide et non visible
    Par Whippet dans le forum ASP.NET
    Réponses: 5
    Dernier message: 18/10/2010, 23h50
  4. [D6] Forcer un composant non visible à se mettre à jour
    Par Nono40 dans le forum Bases de données
    Réponses: 3
    Dernier message: 25/04/2010, 05h07
  5. Composants non visible dans certaines applications
    Par chtom dans le forum Autres Logiciels
    Réponses: 4
    Dernier message: 22/03/2006, 17h33

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