multex.demo
Class SwingFile

java.lang.Object
  |
  +--multex.demo.SwingFile
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class SwingFile
extends java.lang.Object
implements java.awt.event.ActionListener

Copies or moves a file, see methods File.copy(String,String) and File.move(String,String). Serves as a demonstration for reporting an exception which comes from a lower tier in the Swing user interface. Look as first example the command line file handling File, and as second example the AWT interface for file handling AwtFile. Each exception occurring in an ActionListener of the user interface is reported by calling


    multex.Swing.report(ownerFrame, exception);
Further description of the contents of the appearing message dialog see class AwtFile. The complete exception reports looks like:


File input could not be copied to output
CAUSE: java.io.FileNotFoundException: input (Das System kann die angegebene Datei nicht finden)

----------Stack Trace follows:----------
java.io.FileNotFoundException: input (Das System kann die angegebene Datei nicht finden)
   at java.io.FileInputStream.open(Native Method)
   at java.io.FileInputStream.(Unknown Source)
   at File.copy(File.java:94)
WAS CAUSING:
File$CopyFailure: File {0} could not be copied to {1}
{0}=input  {1}=output
   at File.copy(File.java:108)
   at SwingFile$1.actionPerformed(SwingFile.java:71)
   at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
   at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
   at java.awt.Component.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.pumpOneEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)


Method Summary
 void actionPerformed(java.awt.event.ActionEvent i_event)
           
static void main(java.lang.String[] i_args)
          Effect: Creates a Swing user interface for copying a file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(java.lang.String[] i_args)
Effect: Creates a Swing user interface for copying a file


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent i_event)
Specified by:
actionPerformed in interface java.awt.event.ActionListener