]> ruin.nu Git - moosique.git/blob - MooTrackView.java
some changes..
[moosique.git] / MooTrackView.java
1 import javax.swing.*;
2 import java.awt.event.MouseListener;
3 import java.awt.event.MouseEvent;
4 import java.awt.event.MouseMotionAdapter;
5 import java.awt.event.MouseMotionListener;
6 import java.awt.Dimension;
7 import java.awt.*;
8 //import java.awt.Graphics;
9 //import java.awt.Graphics2D;
10 //import java.awt.Rectangle;
11
12 /**
13  * 
14  * 
15  * @author  Andersson, Andreen, Lanneskog, Pehrson
16  * @version 1
17  */
18  
19 public class MooTrackView extends JPanel{
20
21         private MooTrackTitle title;
22         private NoteArea notes;
23         private Rectangle box;
24         private Rectangle box2;
25         //private JPanel notes;
26         
27         /** 
28          * Creates 
29          */
30         public MooTrackView () {
31         this.addMouseMotionListener(doScrollRectToVisible);
32         setLayout(new BorderLayout());
33         this.setBorder(BorderFactory.createLineBorder(Color.black));
34         add(trackTitle(), BorderLayout.NORTH);
35         add(noteView(), BorderLayout.CENTER);
36         }
37         
38         MouseMotionListener doScrollRectToVisible = new MouseMotionAdapter() {
39         public void mouseDragged(MouseEvent e) {
40                 Rectangle r = new Rectangle(e.getX(), e.getY(), 1, 1);
41                 ((JPanel)e.getSource()).scrollRectToVisible(r);
42         }
43         };
44         
45         private JPanel trackTitle () {
46                 title = new MooTrackTitle();
47                 title.setPreferredSize(new Dimension(PANEL_WIDTH, TITLE_HEIGHT));
48                 title.setBorder(BorderFactory.createLineBorder(Color.black));
49                 return title;
50         }
51
52         private JPanel noteView () {
53                 notes = new NoteArea(); 
54                 notes.setBackground(Color.white);
55                 notes.setBorder(BorderFactory.createLineBorder(Color.black));   
56                 return notes;           
57         }
58         
59         class NoteArea extends JPanel {
60                 public void RectanglePanel() {
61                         setPreferredSize(new Dimension(20, 20));
62                 }
63                 
64                 
65                 public void paintComponent(Graphics g) {
66                         super.paintComponent(g);
67                         Graphics2D g2 = (Graphics2D)g;
68                         box = new Rectangle(0,0,20,20);
69                         g2.draw(box);
70                         box2 = new Rectangle(20,0,20,20);
71                         g2.draw(box2);
72                 }
73         }
74         
75         private static final int PANEL_WIDTH = 65;
76         private static final int TITLE_HEIGHT = 40;
77         private static final int NOTEVIEW_HEIGHT = 200;
78
79 }