Community
Participate
Working Groups
Dear sirs, I am new in aspectj I want to combine it with java applet I wrote the following code(which replace normal button with red one)....but: When I run the code inside eclipse as java applet it runs correctly as I expected. but when I use the web browser it only displays the button that has been replaced with the aspect. And the other parts of the interface are not displayed. note: The aspect replace the original button inside the interface with red button. So please How I can solve this problem..? this is tha java code import java.awt.*; import java.applet.*; public class GuiExample extends Applet { Button okButton; TextField nameField; CheckboxGroup radioGroup; Checkbox radio1; Checkbox radio2; Checkbox option; public void init() { setLayout(null); // function printButton returns Button add(printButton()); nameField = new TextField("A TextField",100); radioGroup = new CheckboxGroup(); radio1 = new Checkbox("Radio1", radioGroup,false); radio2 = new Checkbox("Radio2", radioGroup,true); option = new Checkbox("Option",false); nameField.setBounds(20,70,100,40); radio1.setBounds(20,120,100,30); radio2.setBounds(140,120,100,30); option.setBounds(20,170,100,30); add(nameField); add(radio1); add(radio2); add(option); } public Button printButton(){ okButton = new Button("normal button"); okButton.setBounds(20,20,100,30); return (okButton); } } //////////////////////////////////////////////////////////////////////////////// and this is the aspect code: import java.awt.Button; import java.awt.Color; public aspect replaceButton { /** * */ Button okButton; pointcut render(): execution(Button GuiExample.printButton()); Button around(): render(){ Color c= new Color(255,0,0); okButton = new Button("Aspect button"); okButton.setBounds(20,20,100,30); okButton.setBackground(c); return okButton; } } /////////////////////////////////////////////////////////////////////////////// and this is what I include in the HTML page <APPLET CODE="GuiExample.class" WIDTH=200 HEIGHT=50> <PARAM NAME="ARCHIVE" VALUE ="aspectjrt.jar" > //////////////////////////////////////////////////////////////////////////////// Thank you in advance and best regards Sanaa Alsarraj
you could try asking on the AspectJ or AJDT mailing lists? I don't know much about running applets in browsers but I seem to recall people on the list have had it working in the past.