]> ruin.nu Git - moosique.git/blob - MooTrackView.java
no message
[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 JPanel notes;
25         
26         /** 
27          * Creates 
28          */
29         public MooTrackView () {
30         this.addMouseMotionListener(doScrollRectToVisible);
31         setLayout(new BorderLayout());
32         this.setBorder(BorderFactory.createLineBorder(Color.black));
33         add(trackTitle(), BorderLayout.NORTH);
34         add(noteView(), BorderLayout.CENTER);
35         }
36         
37         MouseMotionListener doScrollRectToVisible = new MouseMotionAdapter() {
38         public void mouseDragged(MouseEvent e) {
39                 Rectangle r = new Rectangle(e.getX(), e.getY(), 1, 1);
40                 ((JPanel)e.getSource()).scrollRectToVisible(r);
41         }
42         };
43         
44         private JPanel trackTitle () {
45                 title = new MooTrackTitle();
46                 title.setPreferredSize(new Dimension(PANEL_WIDTH, TITLE_HEIGHT));
47                 title.setBorder(BorderFactory.createLineBorder(Color.black));
48                 return title;
49         }
50
51         private JPanel noteView () {
52                 notes = new NoteArea();
53                 notes.setBorder(BorderFactory.createLineBorder(Color.black));
54                 return notes;
55                         
56         }
57         
58         class NoteArea extends JPanel {
59                 public void RectanglePanel() {
60                         setPreferredSize(new Dimension(20, 20));
61                         //box = new Rectangle(100,100,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                 }
71         }
72         
73         private static final int PANEL_WIDTH = 65;
74         private static final int TITLE_HEIGHT = 20;
75         private static final int NOTEVIEW_HEIGHT = 200;
76
77 }