import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
public class Main extends JFrame
{
/*
*
*
* 이코드는 당신의 것이 아닙니다.
* 제발 이 코드에 덮어서 코딩하지 마세요
*
* 제발...
* 제발...
*
*
*/
public int[] notes = new int[100];
//16 12 8 6 4 3 2 1
//32 24 16 12 8 6 3 2
//조금 더 공부 해야 함
public int[] beats = new int[100];
//이차원 배열로 층 만들기
//일단 도레미파솔라시도부터 하고
/*
* 그 이후에
* # b 추가
* 기타 표현 추가
* 소리 입히기 (피아노 ) 우리에겐 오픈 파일들이 인터넷에 있어 ! :) :( 어라...
*
*
* 일단 음표 무시하고 점으로
*
* */
int px=0,py=0;
class MyPanel extends JPanel{
public Graphics a ;
public void paintComponent(Graphics g) {
super.paintComponent(g);
int start = 150, term=10;
int xstart = 80;
g.setColor(new Color(0,0,0,255));
int i;
PointerInfo pt = MouseInfo.getPointerInfo();
Point mousePoint = new Point(pt.getLocation());
g.fillOval(px,py, term, term);
System.out.println(mousePoint.x+" "+ mousePoint.y);
//mous.getX();
for(i = 0;i < 5;i++)
{
g.drawLine(0, start+term*i, 1000, start+term*i);
}
for(i = 0;i < 100;i++)
{
if(notes[i]!=-100)
{
g.fillOval((i*(int)(term*1.5))+xstart,
start+(int)(((float)(7-notes[i])/2)*term)+term+term/2,
term+term/5,
term);
if(notes[i]<=1)
{
int j;
for(j = 1;j >= notes[i];j--)
{
g.drawLine((i*(int)(term*1.5))+xstart-term/5,
start+((7-j)/2)*term+term+term,
(i*(int)(term*1.5))+term+(int)(term/2)+xstart,
start+((7-j)/2)*term+term+term);
}
}
if(notes[i]>=13)
{
int j;
for(j = 13;j <= notes[i];j++)
{
g.drawLine((i*(int)(term*1.5))+xstart-term/5,
start+((7-j)/2)*term+term+term,
(i*(int)(term*1.5))+term+(int)(term/2)+xstart,
start+((7-j)/2)*term+term+term);
}
}
//if
}
}
System.out.println("aa");
}
}
MyPanel panel = new MyPanel();
class MyMouseListener extends MouseAdapter implements MouseMotionListener{
public void mousePressed(MouseEvent e)
{
px=e.getX();
py=e.getY();
//notes[20]++;
panel.repaint();
}
public void mouseMoved(MouseEvent e)
{
px=e.getX();
py=e.getY();
System.out.println("px : "+px+"py : "+py);
//notes[20]++;
panel.repaint();
}
}
public Main()
{
int i;
for(i = 0;i < 100;i++)
{
notes[i] = -100;
}
panel.addMouseListener(new MyMouseListener());
panel.addMouseMotionListener(new MyMouseListener());
setTitle("망할 음악");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Container c = getContentPane();
//c.setLayout(null);
setContentPane(panel);
for(i = 0;i < 17;i++)
{
notes[i] = i-1;
}/*
notes[10] = 0;
notes[11] = -100;
notes[12] = -1;
notes[13] = -2;*/
setSize(1280,720);
setVisible(true);
}
public static void main(String [] args)
{
new Main();
}
}



