Update of /cvsroot/fb-contrib/fb-contrib/samples
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31704/samples
Modified Files:
SG_Sample.java
Log Message:
parse non listener methods for expensive code, and then parse listener methods. If one of these aux methods is called, then report the listener as sluggish.
Index: SG_Sample.java
===================================================================
RCS file: /cvsroot/fb-contrib/fb-contrib/samples/SG_Sample.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- SG_Sample.java 2 Feb 2006 06:18:02 -0000 1.1
+++ SG_Sample.java 3 Feb 2006 03:45:20 -0000 1.2
@@ -1,9 +1,19 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
+import java.io.ByteArrayInputStream;
import java.io.FileReader;
-public class SG_Sample implements ActionListener
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+
+public class SG_Sample implements ActionListener, WindowListener
{
+ String s = "<xml/>";
+
public void actionPerformed(ActionEvent ae)
{
FileReader fr = null;
@@ -19,5 +29,48 @@
}
}
+
+ public void windowClosing(WindowEvent we)
+ {
+ String s = getRoot();
+ }
+
+ private String getRoot()
+ {
+ try
+ {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document d = db.parse(new ByteArrayInputStream(s.getBytes()));
+ return d.getDocumentElement().getNodeName();
+ }
+ catch (Exception e)
+ {
+ return "";
+ }
+ }
+
+ public void windowActivated(WindowEvent arg0)
+ {
+ }
+ public void windowClosed(WindowEvent arg0)
+ {
+ }
+
+ public void windowDeactivated(WindowEvent arg0)
+ {
+ }
+
+ public void windowDeiconified(WindowEvent arg0)
+ {
+ }
+
+ public void windowIconified(WindowEvent arg0)
+ {
+ }
+
+ public void windowOpened(WindowEvent arg0)
+ {
+ }
}
|