/*
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Main extends JFrame{
MyPanel panel = new MyPanel();
Container c= getContentPane();
public Main(){
setTitle("Random Circle");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setContentPane(panel);
setSize(500,500);
setVisible(true);
}
class MyPanel extends JPanel implements Runnable{
int x,y;
public MyPanel() {
addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e) {
run();
}
});
}
public void run() {
while(true) {
x=(int)(Math.random()*getWidth());
y=(int)(Math.random()*getWidth());
try {
Thread.sleep(400);
}catch(InterruptedException e) {
return;
}
repaint();
}
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawOval(x, y, 50, 50);
}
}
public static void main(String[] args) {
new Main();
}
}
*/
/*
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Main extends JFrame{
Container c = getContentPane();
public Main() {
setTitle("버블 게임");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
c.setLayout(null);
c.addMouseListener(new MyMouseListener());
setSize(500,500);
setVisible(true);
}
class MyMouseListener extends MouseAdapter{
public void mouseClicked(MouseEvent e) {
balloon th = new balloon(e.getX(),e.getY());
th.start();
}
}
class balloon extends Thread{
private int x,y;
public balloon(int x, int y) {
this.x=x;
this.y=y;
}
public void run() {
ImageIcon balloon = new ImageIcon("balloons.png");
JLabel imageLabel = new JLabel(balloon);
c.add(imageLabel);
while(y>0) {
imageLabel.setSize(60,60);
imageLabel.setLocation(x,y);
try {
Thread.sleep(20);
}catch(InterruptedException e) {
return;
}
y-=5;
c.repaint();
}
c.remove(imageLabel);
}
}
public static void main(String[] args) {
new Main();
}
}
*/