|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Panel
|
+--jazz.widget.MusicPanel
| Inner classes inherited from class java.awt.Panel |
java.awt.Panel.AccessibleAWTPanel |
| Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
| Field Summary | |
static int |
CLICK_ERROR
|
int |
clickError
|
protected java.awt.Color[][] |
colors
|
protected boolean |
debug
|
static java.awt.Color |
DEFAULT_HIGHLIGHT_COLOR
|
static int |
DOT_SPACE
|
static int |
DOT_WIDTH
|
int |
dotSpace
|
int |
dotWidth
|
static int |
FLAG_HEIGHT
|
static int |
FLAG_OFFSET
|
static int |
FLAG_WIDTH
|
int |
flagHeight
|
int |
flagOffset
|
int |
flagWidth
|
static int |
FLAT_SPACE
|
static int |
FLAT_WIDTH
|
int |
flatSpace
|
int |
flatWidth
|
protected int |
height
|
java.awt.Color |
highlightColor
|
protected boolean |
isExample
|
static int |
LINE_HEIGHT
|
int |
lineHeight
|
protected java.awt.event.ActionListener |
listener
|
static int |
MEASURE_MARGIN
|
static int |
MEASURE_WIDTH
|
int |
measureMargin
|
protected java.util.Vector |
measures
|
static int |
MEASURES_PER_LINE
|
int |
measuresPerLine
|
int |
measureWidth
|
static int |
MIN_WHITE_SPACE
|
int |
minWhiteSpace
|
static int |
NOTE_HEIGHT
|
static int |
NOTE_WIDTH
|
int |
noteHeight
|
int |
noteWidth
|
protected int |
numMeasures
|
static int |
PIXELS_BETWEEN_FLAGS
|
int |
pixelsBetweenFlags
|
protected java.util.Vector |
points
|
protected int |
selectedPoint
|
static int |
SHARP_SPACE
|
static int |
SHARP_WIDTH
|
int |
sharpSpace
|
int |
sharpWidth
|
static int |
STAVE_HEIGHT
|
int |
staveHeight
|
static int |
STEM_HEIGHT
|
int |
stemHeight
|
protected java.lang.String |
title
|
static int |
TITLE_HEIGHT
|
int |
titleHeight
|
protected int |
width
|
static int |
X_MARGIN
|
int |
xMargin
|
static int |
Y_MARGIN
|
int |
yMargin
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
MusicPanel()
|
|
MusicPanel(int numMeasures)
|
|
MusicPanel(java.lang.String title,
int numMeasures)
|
|
| Method Summary | |
void |
addActionListener(java.awt.event.ActionListener l)
|
protected int |
calculateNoteWidth(Note note)
Calculate the note width of a given note |
protected double |
calculateWhiteSpace(Measure measure)
Calculate the amount of white space in a measure and return a multiplier indicating what percentage of the preferred white space fits in the measure. |
void |
drawChord(Chord chord)
Draw an chord, but with no color highlighting |
void |
drawChord(Chord chord,
java.awt.Color[][] colors)
Draw a chord |
protected void |
drawExample()
Called internally when painting. |
void |
drawExample(Measure measure)
Draw an example, but without color highlighting |
void |
drawExample(Measure measure,
java.awt.Color[][] colors)
Draw an example measure. |
protected void |
drawFlags(jazz.widget.MusicPanel.NotePoint np,
java.awt.Graphics g)
Draw the appropriate number of flags for a note |
protected void |
drawFlat(jazz.widget.MusicPanel.NotePoint np,
java.awt.Graphics g)
Draws a flat sign in front of the given note |
protected void |
drawMeasures()
Calculate the whitespace for a measure and then draw it, shrinking whitespace as is necessary. |
void |
drawMeasures(java.util.Vector measures,
java.awt.Color[][] colors)
Calculate the whitespace for a measure and then draw it, shrinking whitespace as necessary. |
protected void |
drawNote(jazz.widget.MusicPanel.NotePoint np)
Draw a note in a given x position and measure Return the y value for the note |
protected void |
drawNoteHead(jazz.widget.MusicPanel.NotePoint np,
java.awt.Graphics g)
Draw a note head at the given coordinates |
protected void |
drawScore()
Draw the staff lines and all the measures. |
protected void |
drawSharp(jazz.widget.MusicPanel.NotePoint np,
java.awt.Graphics g)
Draws a sharp sign in front of the given note |
protected void |
drawStaffLines(jazz.widget.MusicPanel.NotePoint np,
java.awt.Graphics g)
Draw Lines above or below the staff for a given note |
protected void |
drawStave(int numMeasures,
int stave)
Draw a row of empty measures |
protected void |
drawStem(jazz.widget.MusicPanel.NotePoint np,
java.awt.Graphics g)
Draw the stem for a note at the given coordinates |
void |
erase()
Erase the current screen by drawing a white rectangle |
protected void |
fireActionEvent(java.awt.event.ActionEvent e)
|
int |
getHeight()
* Functions for manipulating different attributes * * |
java.awt.Dimension |
getMinimumSize()
|
java.awt.Dimension |
getPreferredSize()
|
Measure |
getSelectedMeasure()
Find the selected measure, or null |
int |
getSelectedMeasureNum()
Find the selected measure number |
Note |
getSelectedNote()
Find the selected note |
int |
getSelectedNoteNum()
Find the selected note number |
int |
getWidth()
|
boolean |
hasGraphics()
|
void |
layoutInit()
* Functions for drawing different components * * |
protected double |
lineOfPitch(Pitch pitch)
Return the line number in the stave for a given pitch. |
static void |
main(java.lang.String[] args)
|
int |
numberOfStaves()
|
void |
paint(java.awt.Graphics g)
Draw whatever we contain... |
void |
processClick(int x,
int y)
Return the measure and note numbers for the closest note |
void |
processMouseEvent(java.awt.event.MouseEvent e)
* Utility functions for event handling * * |
protected int |
realX(int x)
Translate a relative coordinate to absolute coordinates by account for margins, etc. |
protected int |
realY(int y)
Return an "absolute" y - coordinate for a "relative" y-coordinate by adding in margins. |
void |
removeActionListener(java.awt.event.ActionListener l)
|
void |
repaint()
|
void |
setSelectedNote(int measureNum,
int noteNum)
Set the selected note using the measure and note number Note that the drawMeasures() or drawExample() must already be called containing the note. |
void |
setSelectedNote(Note note)
Set the selected note using a reference to a specific note Note that the drawMeasures() or drawExample() must already be called containing the note. |
protected void |
setSelectedPoint(int pointNum)
Internal function to set the selected point based on the point number |
protected int |
xOfBeat(double beat,
int measure)
Approximate the x value for a given beat accounting for margins, etc. |
protected int |
xOfMeasure(int measure)
Find the x coordinate of a given measure accounting for margins, etc. |
protected int |
xOfStem(Note note,
int x)
Calculate the x coordinate for a note stem account for margins, etc. |
protected int |
yOfLine(double line,
int measure)
Calculate the y value of a line accounting for margins, etc. |
protected int |
yOfLine(int lineNumber,
int measure)
Calculate the y value at the top of the line account for margins, etc. |
protected int |
yOfMeasure(int measure)
Find the y value for a given measure accounting for margins, etc. |
protected int |
yOfPitch(Pitch pitch,
int measure)
Calculate the y value of a pitch accounting for margins, etc. |
protected int |
yOfStave(int stave)
Find the y value for a given stave accounting for margins, etc. |
protected int |
yOfStem(Pitch pitch,
int measure)
Calculate the y value at the top of the stem account for margins, etc. |
| Methods inherited from class java.awt.Panel |
addNotify, getAccessibleContext |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static int DOT_SPACE
public static int DOT_WIDTH
public static int FLAG_HEIGHT
public static int FLAG_WIDTH
public static int FLAG_OFFSET
public static int FLAT_SPACE
public static int FLAT_WIDTH
public static int LINE_HEIGHT
public static int MEASURE_MARGIN
public static int MEASURES_PER_LINE
public static int MEASURE_WIDTH
public static int MIN_WHITE_SPACE
public static int NOTE_HEIGHT
public static int NOTE_WIDTH
public static int PIXELS_BETWEEN_FLAGS
public static int SHARP_SPACE
public static int SHARP_WIDTH
public static int STAVE_HEIGHT
public static int STEM_HEIGHT
public static int TITLE_HEIGHT
public static int X_MARGIN
public static int Y_MARGIN
public static int CLICK_ERROR
public static java.awt.Color DEFAULT_HIGHLIGHT_COLOR
public int dotSpace
public int dotWidth
public int flagHeight
public int flagWidth
public int flagOffset
public int flatSpace
public int flatWidth
public int lineHeight
public int measureMargin
public int measuresPerLine
public int measureWidth
public int minWhiteSpace
public int noteHeight
public int noteWidth
public int pixelsBetweenFlags
public int sharpSpace
public int sharpWidth
public int staveHeight
public int stemHeight
public int titleHeight
public int xMargin
public int yMargin
public int clickError
public java.awt.Color highlightColor
protected java.awt.event.ActionListener listener
protected java.lang.String title
protected int height
protected int width
protected int numMeasures
protected int selectedPoint
protected java.util.Vector measures
protected java.util.Vector points
protected java.awt.Color[][] colors
protected boolean isExample
protected boolean debug
| Constructor Detail |
public MusicPanel()
public MusicPanel(java.lang.String title,
int numMeasures)
public MusicPanel(int numMeasures)
| Method Detail |
public int getHeight()
getHeight in class java.awt.Componentpublic int getWidth()
getWidth in class java.awt.Componentpublic boolean hasGraphics()
public int numberOfStaves()
public void layoutInit()
public void paint(java.awt.Graphics g)
paint in class java.awt.Containerpublic void erase()
protected void drawScore()
public void drawMeasures(java.util.Vector measures,
java.awt.Color[][] colors)
protected void drawMeasures()
public void drawChord(Chord chord)
public void drawChord(Chord chord,
java.awt.Color[][] colors)
public void drawExample(Measure measure)
public void drawExample(Measure measure,
java.awt.Color[][] colors)
protected void drawExample()
protected void drawStave(int numMeasures,
int stave)
protected void drawNote(jazz.widget.MusicPanel.NotePoint np)
protected void drawStaffLines(jazz.widget.MusicPanel.NotePoint np,
java.awt.Graphics g)
protected void drawNoteHead(jazz.widget.MusicPanel.NotePoint np,
java.awt.Graphics g)
protected void drawStem(jazz.widget.MusicPanel.NotePoint np,
java.awt.Graphics g)
protected void drawSharp(jazz.widget.MusicPanel.NotePoint np,
java.awt.Graphics g)
protected void drawFlat(jazz.widget.MusicPanel.NotePoint np,
java.awt.Graphics g)
protected void drawFlags(jazz.widget.MusicPanel.NotePoint np,
java.awt.Graphics g)
public java.awt.Dimension getMinimumSize()
getMinimumSize in class java.awt.Containerpublic java.awt.Dimension getPreferredSize()
getPreferredSize in class java.awt.Containerpublic void repaint()
repaint in class java.awt.Componentprotected double calculateWhiteSpace(Measure measure)
protected int calculateNoteWidth(Note note)
protected int xOfStem(Note note,
int x)
protected int xOfBeat(double beat,
int measure)
protected int xOfMeasure(int measure)
protected int realX(int x)
protected int yOfLine(int lineNumber,
int measure)
protected int yOfStem(Pitch pitch,
int measure)
protected double lineOfPitch(Pitch pitch)
protected int yOfPitch(Pitch pitch,
int measure)
protected int yOfLine(double line,
int measure)
protected int yOfMeasure(int measure)
protected int yOfStave(int stave)
protected int realY(int y)
public void processMouseEvent(java.awt.event.MouseEvent e)
processMouseEvent in class java.awt.Component
public void processClick(int x,
int y)
public int getSelectedMeasureNum()
public void setSelectedNote(Note note)
public void setSelectedNote(int measureNum,
int noteNum)
protected void setSelectedPoint(int pointNum)
public Measure getSelectedMeasure()
public int getSelectedNoteNum()
public Note getSelectedNote()
public void removeActionListener(java.awt.event.ActionListener l)
public void addActionListener(java.awt.event.ActionListener l)
protected void fireActionEvent(java.awt.event.ActionEvent e)
public static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||