Ouverture d'un JDialog dans un thread
Bonjour à tous,
Je suis entrain de créer une application dans laquelle j'ai besoin d'ouvrir une page internet dans une fenêtre Java (browser) tout en gardant mon application active.
Du coup, après avoir cherché un peu partout, j'ai trouvé une librairie : ici
J'ai réussit à ouvrir une page sur google, par contre, j'ai un autre soucis :
Dans mon main, je crée une JFrame qui contient toute l'interface normale de mon application puis, je crée une JDialog contenant la page internet.
Pour ça, je suis obligée de lancer un thread :
Code:
1 2 3 4 5 6 7 8
| UIUtils.setPreferredLookAndFeel();
NativeInterface.open();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new BrowserGoogle();
}
});
NativeInterface.runEventPump(); |
La classe BrowserGoogle héritant de JDialog.
J'ai alors mes deux fenêtres qui se créent, mais la fenêtre principale (la JFrame contenant mon application) semble avoir un problème d'affichage (elle est toute blanche, et certains composants s'affichent uniquement lorsque je passe la souris dessus, ...).
J'ai également l'exception suivante que je n'avais pas avant :
Code:
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
| Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.jtattoo.plaf.BaseSliderUI.paintThumb(BaseSliderUI.java:321)
at com.jtattoo.plaf.BaseSliderUI.paint(BaseSliderUI.java:120)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
at java.awt.Container.paint(Unknown Source)
at java.awt.Window.paint(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source) |
J'ai l'impression (mais je suis tout sauf sure) que le problème vient du fait qu'on lance la création de la JDialog dans un thread mais de toute façon, la librairie utilisée l'oblige.
Avez-vous une idée ou au moins une explication à ce problème ?
Merci d'avance !