]> 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 JScrollPane table;
23         
24         /** 
25          * Creates 
26          */
27         public MooTrackView () {
28         this.addMouseMotionListener(doScrollRectToVisible);
29         setLayout(new BorderLayout());
30         this.setBorder(BorderFactory.createLineBorder(Color.black));
31         add(trackTitle(), BorderLayout.NORTH);
32         add(noteView(), BorderLayout.SOUTH);
33         }
34         
35         MouseMotionListener doScrollRectToVisible = new MouseMotionAdapter() {
36         public void mouseDragged(MouseEvent e) {
37                 Rectangle r = new Rectangle(e.getX(), e.getY(), 1, 1);
38                 ((JPanel)e.getSource()).scrollRectToVisible(r);
39         }
40         };
41         
42         private JPanel trackTitle () {
43                 title = new MooTrackTitle();
44                 title.setPreferredSize(new Dimension(PANEL_WIDTH, TITLE_HEIGHT));
45                 title.setBorder(BorderFactory.createLineBorder(Color.black));
46                 return title;
47         }
48
49         private JScrollPane noteView() {
50                 JScrollPane scrollPane = new JScrollPane(table);
51                 table.setPreferredScrollableViewportSize(new Dimension(500, 70)); 
52                 return scrollPane;      
53                 }
54         }
55                 
56
57         private static final int PANEL_WIDTH = 65;
58         private static final int TITLE_HEIGHT = 20;
59         private static final int NOTEVIEW_HEIGHT = 200;
60         private static final int BOX_WIDTH = 20;
61         private static final int BOX_HEIGHT = 20;
62 }