2 import java.awt.event.*;
6 * Graphical representation of a MIDI track.
8 * @author Andersson, Andreen, Lanneskog, Pehrson
12 public class MooTrackView extends JPanel {
14 private MooTrackTitle title;
15 private NoteArea notes;
16 private Rectangle box;
17 //private Rectangle box2;
18 //private JPanel notes;
20 private static final int PANEL_WIDTH = 65;
21 private static final int TITLE_HEIGHT = 45;
22 private static final int NOTEVIEW_HEIGHT = 200;
27 public MooTrackView () {
28 setLayout(new BorderLayout());
29 this.setBorder(BorderFactory.createLineBorder(Color.black));
30 add(trackTitle(), BorderLayout.NORTH);
31 add(noteView(), BorderLayout.CENTER);
34 private JPanel trackTitle () {
35 title = new MooTrackTitle();
36 title.setPreferredSize(new Dimension(PANEL_WIDTH, TITLE_HEIGHT));
37 title.setBorder(BorderFactory.createLineBorder(Color.black));
41 private JPanel noteView () {
42 notes = new NoteArea();
43 notes.setBackground(Color.white);
44 notes.setBorder(BorderFactory.createLineBorder(Color.black));
48 class NoteArea extends JPanel {
49 public void RectanglePanel() {
50 setPreferredSize(new Dimension(20, 20));
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) {
58 for (r=0;r<200;r=r+20) {
59 box = new Rectangle(r,c,20,20);
60 g2.setColor(Color.gray);