1 54 55 package com.mullassery.act.task; 56 57 import java.awt.event.WindowAdapter ; 58 import java.awt.event.WindowEvent ; 59 60 import javax.swing.JFrame ; 61 import javax.swing.JLabel ; 62 import javax.swing.SwingConstants ; 63 64 import org.apache.tools.ant.BuildException; 65 import org.apache.tools.ant.Task; 66 67 import com.mullassery.act.util.DebugUtil; 68 69 75 public class SampleCustomTask extends Task { 76 77 private String msg; 78 79 public void execute() throws BuildException { 80 try { 81 final JFrame jf = new JFrame (this.getClass().getName()); 82 jf.addWindowListener(new WindowAdapter () { 83 public void windowClosing(WindowEvent arg0) { 84 jf.dispose(); 85 } 86 }); 87 JLabel label = new JLabel (msg, SwingConstants.CENTER); 88 jf.getContentPane().add(label); 89 jf.setLocation(200, 200); 90 jf.pack(); 91 jf.show(); 92 } catch (Exception e) { DebugUtil.debug(msg); 94 } 95 } 96 97 public void setGreeting(String msg) { 98 this.msg = msg; 99 } 100 } 101 | Popular Tags |