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;
21 public MooTrackView () {
22 setLayout(new BorderLayout());
23 this.setBorder(BorderFactory.createLineBorder(Color.black));
24 add(trackTitle(), BorderLayout.NORTH);
25 add(noteView(), BorderLayout.CENTER);
28 private JPanel trackTitle () {
29 title = new MooTrackTitle();
30 title.setPreferredSize(new Dimension(PANEL_WIDTH, TITLE_HEIGHT));
31 title.setBorder(BorderFactory.createLineBorder(Color.black));
35 private JPanel noteView () {
36 notes = new NoteArea();
37 notes.setBackground(Color.white);
38 notes.setBorder(BorderFactory.createLineBorder(Color.black));
42 class NoteArea extends JPanel {
43 public void RectanglePanel() {
44 setPreferredSize(new Dimension(20, 20));
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) {
52 for (r=0;r<200;r=r+20) {
53 box = new Rectangle(r,c,20,20);
54 g2.setColor(Color.gray);
61 private static final int PANEL_WIDTH = 65;
62 private static final int TITLE_HEIGHT = 40;
63 private static final int NOTEVIEW_HEIGHT = 200;