X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=MooNoteElement.java;h=8b71b3cfb31e72caabf1edff3479f1dd930beecf;hb=b707e72e9ba0631a60460dd368019029954a7ec7;hp=8471b53d649fa8b9c49136d3113c85c8f41b4db5;hpb=4e7d6f8b7dd7fbcef2282674b5442d78cf220489;p=moosique.git diff --git a/MooNoteElement.java b/MooNoteElement.java index 8471b53..8b71b3c 100644 --- a/MooNoteElement.java +++ b/MooNoteElement.java @@ -1,4 +1,6 @@ import javax.swing.*; +import java.awt.*; +import java.awt.event.*; /* * Graphical representation of a MIDI note. @@ -7,19 +9,51 @@ import javax.swing.*; * @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 } + }