1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
* TODO: Description of the class.
*
* @author fh
*
* @since TODO: version number
*
*/
public class ButtonTest extends JFrame {
private JPanel panel = new JPanel();
public ButtonTest() {
creerButton();
this.setSize(300, 200);
this.getContentPane().add(panel);
this.setVisible(true);
}
/**
*
*/
private void creerButton() {
int nT = 4;
JButton appelT[] = new JButton[nT];
for (int i = 0; i < nT; i++) {
appelT[i] = new JButton();
appelT[i].setText("Transformation" + i);
panel.add(appelT[i]);
}
}
} |