Re: [aspectwerkz-user] how can weave advice in JFrame

Alexandre Vasseur <[email protected]> Wed, 27 Jul 2005 14:27:02 +0200
Newsgroups gmane.comp.java.aspectwerkz.user
Message-ID <[email protected]>
Hi
Since I suggest you use a call pointcut like
call(* JFrame.add(Component)) && within(Gui2)
// use qualified name with the package prefix instead off course

Alex


On 7/27/05, Shiqiang Guo <[email protected]> wrote:
> user,
> 
>    I want weave an before advice into mehtod JFrame.add(Component comp), but It can not run.
> 
>    My test souce code is very simple:
> 
> 
>    public class Gui2 {
> 
>         public static void main(String[] args) {
> 
>                 JFrame frame = new JFrame();
>                 frame.setTitle("TestFrame");
>                 frame.setSize(200, 200);
>                 frame.setLocation(200, 300);
>                 frame.addWindowListener(new WindowAdapter() {
>                         public void windowCLosing(WindowEvent e) {
>                                 System.exit(0);
>                         }
>                 });
>                 JButton bt1 = new JButton("Bt1");
>                 frame.add(bt1, "Center");           <<<<
>                 frame.show();
> 
>         }
> }
> 
> 
>      How can get it ?
>   
> 
> Shiqiang Guo
> [email protected]
> 2005-07-27
>