Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.chordcast.ui
Class Neck  view Neck download Neck.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JLabel
                  extended byorg.chordcast.ui.Neck
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.swing.SwingConstants

public class Neck
extends javax.swing.JLabel

The gui of a guitar neck.


Nested Class Summary
 
Nested classes inherited from class javax.swing.JLabel
javax.swing.JLabel.AccessibleJLabel
 
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  javax.swing.border.TitledBorder border
           
private static int BOTTOM_MARGIN
           
private  org.chordcast.data.Chord chord
           
private  byte currentElement
           
private static double editableRatio
           
private static int ELEMENT_SIZE
           
private static java.awt.Font exportFont
           
private static double exportRatio
           
private static int FRET_SPACING
           
private static int HORIZONTAL_MARGIN
           
private  boolean isEditable
           
private static java.awt.Font printFont
           
static java.awt.Color PRINTING_COLOR
           
private static double printRatio
           
static java.awt.Color SHOWING_COLOR
           
private static int STRING_SPACING
           
private static int TOP_MARGIN
           
private static java.awt.Font viewFont
           
private static double viewRatio
           
 
Fields inherited from class javax.swing.JLabel
labelFor
 
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 javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Neck(org.chordcast.data.Chord hisChord)
          Initialize the Neck with hisChord value.
 
Method Summary
 void changeBorder()
          Permit to update the border and the startfret
 void changeDimension()
           
protected  int findBlocOrigineX(int stringNB, double ratio)
          methods use to localise positions where to draw the elements
protected  int findBlocOrigineY(int fretNB, double ratio)
          methods use to localise positions where to draw the elements
protected  int findBlocRelativeX(int stringNB, double ratio)
          methods use to localise positions where to draw the elements
 org.chordcast.data.Chord getChord()
          Return the Chord that the Neck represent.
 byte getCurrentElement()
          Get the Current Element
protected  java.awt.Dimension getDimension(double ratio)
          Get the dimension needed for the graphics with a specified ratio
 int getElementSize()
          Get the ELEMENT_SIZE Size
 java.awt.Dimension getExportDimension()
          Get the dimension needed for the graphics on which draw the chord img (to export as image file)
 java.awt.Font getExportFont()
           
 double getExportRatio()
           
 int getFretSpacing()
          Return the distance between two fret
 int getHorizontalMargin()
          Get the X start position of the Neck
protected  java.awt.Dimension getNormalDimension()
          Get the dimension needed for the graphics with a ratio of 1d
 java.awt.Dimension getPrintDimension()
          Get the dimension needed for the graphics on which draw the chord img (to print)
 java.awt.Font getPrintFont()
           
 double getPrintRatio()
           
 int getStringSpacing()
          Return the distance between two string
 int getTopMargin()
          Get the Y start position of the Neck
 java.awt.Dimension getViewDimension()
          Get the dimension needed for the graphics on which draw the chord img (to show on the screen (as a component))
 java.awt.Font getViewFont()
           
 double getViewRatio()
           
protected  void paintBARRED(java.awt.Graphics g, int x, int y, int startX, int startY, double ratio)
          Draw a "barred square" on the Neck at the specified position
 void paintBlankChord(java.awt.Graphics g, int startX, int startY, double ratio)
          Draw the Neck without elements
 void paintComponent(java.awt.Graphics g)
          Paint the Neck
protected  void paintDOT(java.awt.Graphics g, int x, int y, int startX, int startY, double ratio)
           
 void paintImg(java.awt.Graphics g, int startX, int startY)
          Draw the Chord on a graphic for generate images used in the html
 void paintItSelf(java.awt.Graphics g, int startX, int startY, double ratio)
          Séquential parsing of the Chord elements
protected  void paintIXE(java.awt.Graphics g, int x, int y, int startX, int startY, double ratio)
          Draw a X on the Neck at the specified position
protected  void paintSQUARE(java.awt.Graphics g, int x, int y, int startX, int startY, double ratio)
           
protected  void paintZERO(java.awt.Graphics g, int x, int y, int startX, int startY, double ratio)
          Draw a 0 on the Neck at the specified position
 void printImg(java.awt.Graphics g, int startX, int startY)
           
 void setCurrentElement(byte elem)
          Set the Current Element
 void setEditable(boolean editable)
           
 void setExportFont(java.awt.Font newFont)
           
 void setExportRatio(double newRatio)
           
 void setPrintFont(java.awt.Font newFont)
           
 void setPrintRatio(double newRatio)
           
 void setViewFont(java.awt.Font newFont)
           
 void setViewRatio(double newRatio)
           
 
Methods inherited from class javax.swing.JLabel
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setFont, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, 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, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, 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, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STRING_SPACING

private static final int STRING_SPACING
See Also:
Constant Field Values

FRET_SPACING

private static final int FRET_SPACING
See Also:
Constant Field Values

HORIZONTAL_MARGIN

private static final int HORIZONTAL_MARGIN
See Also:
Constant Field Values

TOP_MARGIN

private static final int TOP_MARGIN
See Also:
Constant Field Values

BOTTOM_MARGIN

private static final int BOTTOM_MARGIN
See Also:
Constant Field Values

ELEMENT_SIZE

private static final int ELEMENT_SIZE
See Also:
Constant Field Values

viewFont

private static java.awt.Font viewFont

printFont

private static java.awt.Font printFont

exportFont

private static java.awt.Font exportFont

viewRatio

private static double viewRatio

printRatio

private static double printRatio

exportRatio

private static double exportRatio

editableRatio

private static double editableRatio

isEditable

private boolean isEditable

currentElement

private byte currentElement

border

private javax.swing.border.TitledBorder border

chord

private final org.chordcast.data.Chord chord

SHOWING_COLOR

public static java.awt.Color SHOWING_COLOR

PRINTING_COLOR

public static java.awt.Color PRINTING_COLOR
Constructor Detail

Neck

public Neck(org.chordcast.data.Chord hisChord)
Initialize the Neck with hisChord value.

Method Detail

setEditable

public void setEditable(boolean editable)

getNormalDimension

protected java.awt.Dimension getNormalDimension()
Get the dimension needed for the graphics with a ratio of 1d


getDimension

protected java.awt.Dimension getDimension(double ratio)
Get the dimension needed for the graphics with a specified ratio


getPrintDimension

public java.awt.Dimension getPrintDimension()
Get the dimension needed for the graphics on which draw the chord img (to print)


getExportDimension

public java.awt.Dimension getExportDimension()
Get the dimension needed for the graphics on which draw the chord img (to export as image file)


getViewDimension

public java.awt.Dimension getViewDimension()
Get the dimension needed for the graphics on which draw the chord img (to show on the screen (as a component))


getChord

public org.chordcast.data.Chord getChord()
Return the Chord that the Neck represent.


getStringSpacing

public int getStringSpacing()
Return the distance between two string


getFretSpacing

public int getFretSpacing()
Return the distance between two fret


getHorizontalMargin

public int getHorizontalMargin()
Get the X start position of the Neck


getTopMargin

public int getTopMargin()
Get the Y start position of the Neck


getElementSize

public int getElementSize()
Get the ELEMENT_SIZE Size


getCurrentElement

public byte getCurrentElement()
Get the Current Element


setCurrentElement

public void setCurrentElement(byte elem)
Set the Current Element


changeBorder

public void changeBorder()
Permit to update the border and the startfret


changeDimension

public void changeDimension()

paintComponent

public void paintComponent(java.awt.Graphics g)
Paint the Neck


printImg

public void printImg(java.awt.Graphics g,
                     int startX,
                     int startY)

paintImg

public void paintImg(java.awt.Graphics g,
                     int startX,
                     int startY)
Draw the Chord on a graphic for generate images used in the html


paintItSelf

public void paintItSelf(java.awt.Graphics g,
                        int startX,
                        int startY,
                        double ratio)
Séquential parsing of the Chord elements


getViewRatio

public double getViewRatio()

setViewRatio

public void setViewRatio(double newRatio)

getExportRatio

public double getExportRatio()

setExportRatio

public void setExportRatio(double newRatio)

getPrintRatio

public double getPrintRatio()

setPrintRatio

public void setPrintRatio(double newRatio)

getViewFont

public java.awt.Font getViewFont()

setViewFont

public void setViewFont(java.awt.Font newFont)

getExportFont

public java.awt.Font getExportFont()

setExportFont

public void setExportFont(java.awt.Font newFont)

getPrintFont

public java.awt.Font getPrintFont()

setPrintFont

public void setPrintFont(java.awt.Font newFont)

paintDOT

protected void paintDOT(java.awt.Graphics g,
                        int x,
                        int y,
                        int startX,
                        int startY,
                        double ratio)

paintSQUARE

protected void paintSQUARE(java.awt.Graphics g,
                           int x,
                           int y,
                           int startX,
                           int startY,
                           double ratio)

paintBARRED

protected void paintBARRED(java.awt.Graphics g,
                           int x,
                           int y,
                           int startX,
                           int startY,
                           double ratio)
Draw a "barred square" on the Neck at the specified position


paintIXE

protected void paintIXE(java.awt.Graphics g,
                        int x,
                        int y,
                        int startX,
                        int startY,
                        double ratio)
Draw a X on the Neck at the specified position


paintZERO

protected void paintZERO(java.awt.Graphics g,
                         int x,
                         int y,
                         int startX,
                         int startY,
                         double ratio)
Draw a 0 on the Neck at the specified position


paintBlankChord

public void paintBlankChord(java.awt.Graphics g,
                            int startX,
                            int startY,
                            double ratio)
Draw the Neck without elements


findBlocOrigineX

protected int findBlocOrigineX(int stringNB,
                               double ratio)
methods use to localise positions where to draw the elements


findBlocRelativeX

protected int findBlocRelativeX(int stringNB,
                                double ratio)
methods use to localise positions where to draw the elements


findBlocOrigineY

protected int findBlocOrigineY(int fretNB,
                               double ratio)
methods use to localise positions where to draw the elements