]> ruin.nu Git - moosique.git/blob - MooTrackView.java
no message
[moosique.git] / MooTrackView.java
1 import javax.swing.*;
2 import java.awt.event.*;
3 import java.awt.*;
4
5 /**
6  * Graphical representation of a MIDI track.
7  * 
8  * @author  Andersson, Andreen, Lanneskog, Pehrson
9  * @version 1
10  */
11  
12 public class MooTrackView extends JPanel {
13
14         private MooTrackTitle title;
15         private NoteArea notes;
16         private Rectangle box;
17         //private Rectangle box2;
18         /** 
19          * Creates 
20          */
21         public MooTrackView () {
22                 setLayout(new BorderLayout());
23                 this.setBorder(BorderFactory.createLineBorder(Color.black));
24                 add(trackTitle(), BorderLayout.NORTH);
25                 add(noteView(), BorderLayout.CENTER);
26                 }
27         
28         private JPanel trackTitle () {
29                 title = new MooTrackTitle();
30                 title.setPreferredSize(new Dimension(PANEL_WIDTH, TITLE_HEIGHT));
31                 title.setBorder(BorderFactory.createLineBorder(Color.black));
32                 return title;
33         }
34
35         private JPanel noteView () {
36                 notes = new NoteArea(); 
37                 notes.setBackground(Color.white);
38                 notes.setBorder(BorderFactory.createLineBorder(Color.black));   
39                 return notes;           
40         }
41         
42         class NoteArea extends JPanel {
43                 public void RectanglePanel() {
44                         setPreferredSize(new Dimension(20, 20));
45                 }
46                 
47                 public void paintComponent(Graphics g) {
48                         super.paintComponent(g);
49                         Graphics2D g2 = (Graphics2D)g;
50                         for (int c=0;c<1000;c=c+20) {
51                                 int r=0;
52                                 for (r=0;r<200;r=r+20) {
53                                         box = new Rectangle(r,c,20,20);
54                                         g2.setColor(Color.gray);
55                                         g2.draw(box);
56                                 }
57                         }
58                 }
59         }
60
61         private static final int PANEL_WIDTH = 65;
62         private static final int TITLE_HEIGHT = 40;
63         private static final int NOTEVIEW_HEIGHT = 200;
64 }