Help me find what's the problem! Thanks!

In my meaning, I want to click the button (transformbutton), then will achieve the transformation process. (The transformation process has been test successfully, now I defined it as a method). There might be something wrong with the action, but I don't know where it is. When I click the button, there is nothing happen.
Could anybody help me check and solve this problem? Thanks a lot!
The code is attached below:-
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
public class Interface extends JApplet
String[] birdname ={"", "chaffinch", "barn_swallow"};
JPanel jPanel1 = new JPanel();
JLabel jLabel1 = new JLabel();
JComboBox birdBox = new JComboBox(birdname);
JButton transformButton = new JButton("Transform");
JTextField text = new JTextField(30);
//Initialize the applet
public void init()
try
jbInit();
catch(Exception e)
e.printStackTrace();
//Component initialization
private void jbInit() throws Exception
birdBox.setSelectedIndex(0);
this.setSize(new Dimension(400, 300));
jPanel1.setBackground(new Color(0, 83, 255));
jPanel1.setPreferredSize(new Dimension(400, 300));
jLabel1.setFont(new java.awt.Font("Dialog", 1, 12));
jLabel1.setBounds(65,55,150,25);
jLabel1.setForeground(Color.white);
jLabel1.setText("Select a Bird");
birdBox.setBackground(Color.white);
transformButton.setBounds(75,75,60,25);
this.getContentPane().add(jPanel1, BorderLayout.CENTER);
jPanel1.add (jLabel1);
jPanel1.add(birdBox);
jPanel1.add(transformButton);
jPanel1.add(text);
transformButton.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
try
Transform();
text.setText ("The Transformation is finished!");
catch (IOException ex)
catch (TransformerException ex)
public void Transform() throws TransformerException, TransformerConfigurationException,
FileNotFoundException, IOException
//first round transformation
TransformerFactory tFactory = TransformerFactory.newInstance ();
Transformer transformer = tFactory.newTransformer (new StreamSource ("onebird.xsl"));
transformer.transform (new StreamSource ("birds_06_2_oneBird_2_xmlbackend.xml"), new StreamResult (new FileOutputStream ("chaffinch.xml")));
System.out.print ("The Transformation is finished!");
}

And, I have obtained that exception by adding the system.out.print() in the catch clause. This exception is caused by the TransformerException.
I expect that somebody can help me get rid of that exception and made the transformation successfully.
Waiting for the answer online.....Thanks!

Similar Messages

Maybe you are looking for