]> ruin.nu Git - moosique.git/blob - MooTrackView.java
some gui changes..
[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         //private JPanel notes;
19
20         private static final int PANEL_WIDTH = 65;
21         private static final int TITLE_HEIGHT = 45;
22         private static final int NOTEVIEW_HEIGHT = 200;
23         
24         /** 
25          * Creates 
26          */
27         public MooTrackView () {
28                 setLayout(new BorderLayout());
29                 this.setBorder(BorderFactory.createLineBorder(Color.black));
30                 add(trackTitle(), BorderLayout.NORTH);
31                 add(noteView(), BorderLayout.CENTER);
32                 }
33         
34         private JPanel trackTitle () {
35                 title = new MooTrackTitle();
36                 title.setPreferredSize(new Dimension(PANEL_WIDTH, TITLE_HEIGHT));
37                 title.setBorder(BorderFactory.createLineBorder(Color.black));
38                 return title;
39         }
40
41         private JPanel noteView () {
42                 notes = new NoteArea(); 
43                 notes.setBackground(Color.white);
44                 notes.setBorder(BorderFactory.createLineBorder(Color.black));   
45                 return notes;           
46         }
47         
48         class NoteArea extends JPanel {
49                 public void RectanglePanel() {
50                         setPreferredSize(new Dimension(20, 20));
51                 }
52                 
53                 public void paintComponent(Graphics g) {
54                         super.paintComponent(g);
55                         Graphics2D g2 = (Graphics2D)g;
56                         for (int c=0;c<1000;c=c+20) {
57                                 int r=0;
58                                 for (r=0;r<200;r=r+20) {
59                                         box = new Rectangle(r,c,20,20);
60                                         g2.setColor(Color.gray);
61                                         g2.draw(box);
62                                 }
63                         }
64                 }
65         }
66 }