Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] simple question

I want write aspect for set ToolTip text for all comonents, but this picks out no  join points.
Help me please.

import javax.swing.JComponent;
public aspect AddToolTip {
	pointcut newJ(javax.swing.JComponent c):
		call(javax.swing.JComponent+.new(..))&& target(c);
	before(javax.swing.JComponent c) : newJ(c){
		c.setToolTipText("OK");		
	}
}


import javax.swing.*;
import java.awt.*;
public class MyFrame extends JFrame{
	public static void main(String[] args){
		MyFrame f=new MyFrame();		
		f.setSize(300,300);
		JPanel cp=new JPanel(new FlowLayout());
		JButton b=new JButton("Ok");
		cp.add(b);
		f.setContentPane(cp);
		f.show();
	}

}

Dmitriy.



Back to the top