|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel dguitar.gui.Bar
This class represents a musicl bar (it contains a musical measure)
Nested Class Summary |
Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
private java.awt.Color |
backGround
|
protected BarPanel |
BP
|
private java.lang.String |
denominator
The denominator of the KeySignature |
private DisplayOptions |
displayOptions
|
protected boolean |
displayTimeSignature
is the Time Signature displayed |
private java.awt.Color |
foreGround
|
protected boolean |
isFirst
is this the first bar of a track |
protected boolean |
isLast
is the last bar of a track |
protected GPMeasure |
measure
If the Bar is link to a GPMeasure, this field is NOT null |
protected int |
minx
the minimun X position to start drawing ; |
private java.lang.String |
numerator
The numerator of the KeySignature |
int |
TS
The width increased if the Time Signature is being displayed |
Fields inherited from class javax.swing.JPanel |
|
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Container |
|
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 | |
Bar(DisplayOptions currentDisplayOptions,
BarPanel bp)
Creates a new instance of Bar based on a BarPanel |
Method Summary | |
private int |
calculateTS(java.awt.Graphics g)
|
protected abstract int |
calculateWidth(int inc)
|
private int |
calculateWidthInc()
Calculate how mucho to INCrease the WIDTH of a bar because of repeteations |
private void |
commonConstructor()
|
boolean |
equals(java.lang.Object o)
|
boolean |
equalTimeSignature(Bar bar)
This method returns true if This Time signature is equal to the Bar |
int |
getBottomOffset()
|
DisplayOptions |
getDisplayOptions()
|
boolean |
getExtendBottom()
|
boolean |
getExtendTop()
|
int |
getHeight()
Returns the current height of this component. |
java.awt.Dimension |
getMaximumSize()
if the maximum size has been set to a non- null value
just returns it. |
GPMeasure |
getMeasure()
|
java.awt.Dimension |
getMinimumSize()
|
abstract MusicCursorPosition |
getMusicCursorPosition(int beat)
|
abstract MusicCursorPosition |
getMusicCursorPosition(MusicCursor musicCursor)
|
java.awt.Dimension |
getPreferredSize()
|
int |
getTopOffset()
|
int |
getWidth()
Returns the current width of this component. |
protected void |
paintComponent(java.awt.Graphics gg)
Calls the UI delegate's paint method, if the UI delegate is non- null . |
protected void |
paintMeasure(java.awt.Graphics g)
|
void |
setBottomOffset(int bottomOffset)
|
void |
setDisplayOptions(DisplayOptions displayOptions)
|
void |
setExtendBottom(boolean value)
|
void |
setExtendTop(boolean value)
|
void |
setMeasure(GPMeasure m)
|
void |
setTopOffset(int topOffset)
|
abstract MusicCursorPosition |
snapX(int x,
MusicCursor musicCursor)
|
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public int TS
protected boolean isFirst
protected boolean isLast
private DisplayOptions displayOptions
protected boolean displayTimeSignature
protected int minx
private java.lang.String numerator
private java.lang.String denominator
protected GPMeasure measure
protected BarPanel BP
private final java.awt.Color backGround
private final java.awt.Color foreGround
Constructor Detail |
public Bar(DisplayOptions currentDisplayOptions, BarPanel bp)
Method Detail |
private void commonConstructor()
public void setDisplayOptions(DisplayOptions displayOptions)
setDisplayOptions
in interface OptionsDisplay
displayOptions
- The displayOptions to set.public DisplayOptions getDisplayOptions()
getDisplayOptions
in interface OptionsDisplay
public boolean equalTimeSignature(Bar bar)
public boolean equals(java.lang.Object o)
public int getTopOffset()
public void setTopOffset(int topOffset)
public int getBottomOffset()
public void setBottomOffset(int bottomOffset)
public boolean getExtendTop()
public void setExtendTop(boolean value)
public boolean getExtendBottom()
public void setExtendBottom(boolean value)
public GPMeasure getMeasure()
public void setMeasure(GPMeasure m)
private int calculateTS(java.awt.Graphics g)
private int calculateWidthInc()
protected void paintMeasure(java.awt.Graphics g)
public int getHeight()
component.getBounds().height
, or
component.getSize().height
because it doesn't cause any
heap allocations.
protected abstract int calculateWidth(int inc)
public abstract MusicCursorPosition getMusicCursorPosition(int beat)
public abstract MusicCursorPosition getMusicCursorPosition(MusicCursor musicCursor)
public abstract MusicCursorPosition snapX(int x, MusicCursor musicCursor)
public int getWidth()
component.getBounds().width
, or
component.getSize().width
because it doesn't cause any
heap allocations.
public java.awt.Dimension getMinimumSize()
public java.awt.Dimension getPreferredSize()
protected void paintComponent(java.awt.Graphics gg)
null
. We pass the delegate a copy of the
Graphics
object to protect the rest of the
paint code from irrevocable changes
(for example, Graphics.translate
).
if you override this in a subclass you should not make permanent
changes to the passed in Graphics
. for example, you
should not alter the clip Rectangle
or modify the
transform. if you need to do these operations you may find it
easier to create a new Graphics
from the passed in
Graphics
and manipulate it. Further, if you do not
invoker super's implementation you must honor the opaque property,
that is
if this component is opaque, you must completely fill in the background
in a non-opaque color. if you do not honor the opaque property you
will likely see visual artifacts.
gg
- the Graphics
object to protectComponent.paint(java.awt.Graphics)
public java.awt.Dimension getMaximumSize()
null
value
just returns it. if the UI delegate's getMaximumSize
method returns a non-null
value then return that;
otherwise defer to the component's layout manager.
maximumSize
property
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |