Created
June 27, 2013 23:54
-
-
Save Avalarion/5881407 to your computer and use it in GitHub Desktop.
Kleines Beispiel zum Thema Quellen Angabe bei Javas ActionListener für eine Studentin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Test; | |
import java.awt.*; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
public class Java extends Frame{ | |
public static void main(String[] args) { | |
Java java = new Java(); | |
} | |
public Java(){ | |
for(int i = 0; i < 10; i++) { | |
for(int j = 0; j < 10; j++) { | |
Button button = new Button(i + ":" + j); | |
button.setBounds(25*i,25*i,20,20); | |
button.addActionListener(new ActionListener() { | |
@Override | |
public void actionPerformed(ActionEvent actionEvent) { | |
((Button)actionEvent.getSource()).setEnabled(false); | |
} | |
}); | |
this.add(button); | |
} | |
} | |
this.setLayout(new FlowLayout()); | |
this.setBounds(500,500,500,500); | |
this.validate(); | |
this.setVisible(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment