X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=MooNoteElement.java;h=b42bcb96e73f2a2b532ae28e72b02d79cfe3f248;hb=d7666fadd2f8baca8a03cacae836f2563fe4dd5d;hp=8471b53d649fa8b9c49136d3113c85c8f41b4db5;hpb=4e7d6f8b7dd7fbcef2282674b5442d78cf220489;p=moosique.git diff --git a/MooNoteElement.java b/MooNoteElement.java index 8471b53..b42bcb9 100644 --- a/MooNoteElement.java +++ b/MooNoteElement.java @@ -1,25 +1,59 @@ import javax.swing.*; +import java.awt.*; +import java.awt.event.*; -/* +/** * Graphical representation of a MIDI note. * * @author Andersson, Andreen, Lanneskog, Pehrson * @version 1 */ -public class MooNoteElement { +public class MooNoteElement extends JPanel{ - /* + private MooNote note; + /** * Creates a new note element. + * @param mn The note that will be graphically represented */ - public MooNoteElement () { + public MooNoteElement (MooNote mn) { + note = mn; + setPreferredSize(new Dimension(20,20)); + class MouseList implements MouseListener{ + public void mouseClicked(MouseEvent event){ + //Bring upp dialog to edit note. + } + + public void mouseEntered(MouseEvent event){ + //Show note props in statusbar? + } + + public void mouseExited(MouseEvent event){ + //Reset statusbar? + } + + public void mousePressed(MouseEvent event){ } + + public void mouseReleased(MouseEvent event){} + }; + MouseListener listener = new MouseList(); + addMouseListener(listener); + } - /* - * + /*** + * */ - public void () { - + public void paintComponent(Graphics g) + { + super.paintComponent(g); + + if (!(g instanceof Graphics2D)) + return; + Graphics2D g2 = (Graphics2D)g; + + //Draw the note representation } + }