Evénements import java.awt.event.ActionListener;
{"Image DocumentName": "Ev\u00e9nements import java.awt.event.ActionListener;", "Image ImageDescription": "import java.awt.event.ActionEvent; import java.awt.Label; import java.awt.Color; public class Delegue1. implements ActionListener { private Label leLabel; private boolean etatLabel; public Delegue1(Label lab) { leLabel = lab; etatLabel=true; } public void actionPerformed (ActionEvent event) { etatLabel = ! etatLabel; if (etatLabel) leLabel.setForeground (Color.red); else. leLabel.setForeground (Color.blue); Delegue1 impl\u00e9mente l interface ActionListener puisqu il est susceptible de recevoir de tel \u00e9v\u00e9nement. La r\u00e9ception d un tel \u00e9v\u00e9nement provoque l ex\u00e9cution de la m\u00e9thode actionPerformed. Ici, la m\u00e9thode actionPerformed change la couleur du label de notre Applet puisque l objet Delegue1 \u00e0 une r\u00e9f\u00e9rence sur le label. Label est un Component dont la m\u00e9thode setForeground est h\u00e9rit\u00e9e.", "Image XResolution": "37", "Image YResolution": "37", "Image ResolutionUnit": "Pixels/Centimeter", "Image Software": "SlidePlayer", "Image YCbCrPositioning": "Centered"}