Re-Bonjour,
je debute pour l'impression d'une fenetre, j'ai donc fait des recherche sur le net, et j'ai trouver uns source, je l'ai implémenté, j'ai bien ma fenêtre pour choisir l'impression, mais une fois que je clik sur OK, j'ai une exception.
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
 
printMenuItem.addActionListener(new java.awt.event.ActionListener() { 
      	public void actionPerformed(java.awt.event.ActionEvent e) {    
          // @AM TODO
          Properties props = new Properties();
 
          props.put("awt.print.paperSize", "a4");
          props.put("awt.print.destination", "printer");
 
 
          PrintJob pJob = getToolkit().getPrintJob(MyFrame.this,
      			  "Printing_Test", props);
          if (pJob != null)
            {
              Graphics pg = pJob.getGraphics();
              printAll(pg);
              pg.dispose();
              pJob.end();
            }
      	}
      });
et voila l'execption :
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: sun.print.ProxyPrintGraphics
at com.incors.plaf.kunststoff.KunststoffUtilities.drawGradient(Unknown Source)
at com.incors.plaf.kunststoff.KunststoffTabbedPaneUI.paintTab(Unknown Source)
at javax.swing.plaf.basic.BasicTabbedPaneUI.paintTabArea(Unknown Source)
at javax.swing.plaf.basic.BasicTabbedPaneUI.paint(Unknown Source)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at javax.swing.JComponent.printComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.print(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JSplitPane.paintChildren(Unknown Source)
at javax.swing.JComponent.printChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.print(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.printChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.print(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.printChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.print(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.printChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.print(Unknown Source)
at java.awt.GraphicsCallback$PrintCallback.run(Unknown Source)
at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
at java.awt.Container.print(Unknown Source)
at sun.awt.windows.WComponentPeer.print(Unknown Source)
at sun.awt.windows.WCanvasPeer.print(Unknown Source)
at sun.awt.windows.WPanelPeer.print(Unknown Source)
at java.awt.GraphicsCallback$PeerPrintCallback.run(Unknown Source)
at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
at java.awt.Component.printAll(Unknown Source)
at dsi.emc.pac7000.ui.Pac7000UI$6.actionPerformed(Pac7000UI.java:1236)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(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 tout mis, ce n'était peut etre pas nécéssaire, mais ...
voila donc je ne comprends pas... c'est peut etre en lien avec ma Frame, c'est la fenetre global de mon application, donc elle possede plein de chose, JMenu, JPanel, JTree... peut etre que cela ne lui plait pas ?
Donc si vous avez une idée, je vous en remercie d'avance de me la faire partagé.