2025 05 25 Goodbye!
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Main extends JFrame {
private JLabel [] la = new JLabel[10];
public Main() {
setTitle("Ten 레이블 클릭");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(null);
for(int i=0;i<10;i++) {
la[i] = new JLabel(Integer.toString(i));
la[i].setSize(50, 50);
int x = (int)(Math.random()*230)+30;
int y = (int)(Math.random()*230)+30;
la[i].setLocation(x,y);
c.add(la[i]);
}
setSize(300,300);
setVisible(true);
}
private class MyActionListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
}
}
public static void main(String[] args) {
new Main();
}
}
1회 조회




