public class DefaultGCanvas extends JPanel implements GCanvas
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CURSOR |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
DefaultGCanvas(Color backgroundColor)
Contructor.Inicializa el objeto asignando color de fondo.
|
Modifier and Type | Method and Description |
---|---|
void |
addBorder(int x1,
int y1,
int x2,
int y2) |
void |
addDrawableElement(DrawableElement element)
Añade un elemento dibujable a la lista
|
void |
addValueChangedListener(IGCanvasListener listener)
Añadir un listener a la lista de eventos
|
void |
callDataChanged(String key,
Object value)
Invocar a los eventos asociados al componente
|
void |
callDataDragged(String key,
Object value)
Invocar a los eventos asociados al componente
|
DrawableElement |
createBorderLayerForGCanvas(Color color)
Creates a border layer to the graphic canvas
|
DensitySlicingLine |
createDensitySliceForGCanvas(Color color,
int levels)
Creates a density slice function for the graphic canvas
|
GraphicHistogram |
createHistogramForGCanvas(double[] data,
Color color)
Creates a histogram for the graphic canvas
|
InfoLayer |
createInfoLayerForGCanvas(Color colorLayer)
Creates a information layer for the graphic canvas
|
LogaritmicExponentialLine |
createLogaritmicExponentialLineForGCanvas(Color color,
double point)
Creates a logaritmic or exponential function layer for the graphic canvas
|
MinMaxLines |
createMinMaxLinesForGCanvas(Color color)
Creates a minmax layer for the graphic canvas
|
SquareRootPowLine |
createSquareRootPowLineForGCanvas(Color color,
double point)
Creates a square root or pow line function for the graphic canvas
|
StraightLine |
createStraightLineForGCanvas(Color color)
Creates a straight line layer for the graphic canvas
|
void |
execFirstDrawActions()
Ejecuta las acciones antes del primer dibujado de todos
los elementos dibujables
|
int |
getCanvasHeight()
Obtiene el alto del canvas sumando a partir de getCanvasY donde termina el área de dibujo
|
int |
getCanvasMaxX()
Obtiene la posición máxima en X del canvas donde terminar el dibujado
|
int |
getCanvasMaxY()
Obtiene la posición máxima en Y del canvas donde terminar el dibujado
|
int |
getCanvasMinX()
Obtiene la posición mínima en X del canvas donde comenzar a dibujar
|
int |
getCanvasMinY()
Obtiene la posición mínima en Y del canvas donde comenzar a dibujar
|
int |
getCanvasWidth()
Obtiene el ancho del canvas sumando a partir de getCanvasX donde termina el área de dibujo
|
List<DrawableElement> |
getDrawableElements(Class<?> c1)
Obtiene todos los elementos dibujable que sean una instancia de c1
|
boolean |
isMouse()
Devuelve si en ese momento el raton esta sobre el canvas
|
void |
mouseClicked(MouseEvent e) |
void |
mouseDragged(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mouseMoved(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
void |
paint(Graphics g)
Inicializa el fondo y dibuja el gráfico sobre el canvas.
|
void |
removeDrawableElement(Class<?> cl)
Elimina un elemento dibujable
|
void |
removeValueChangedListener(IGCanvasListener listener)
Borrar un listener de la lista de eventos
|
void |
replaceDrawableElement(DrawableElement element)
Reemplaza un elemento dibujable si encuentra uno de su mismo tipo
|
void |
replaceDrawableElement(DrawableElement element,
Class<?> cl)
Reemplaza un elemento dibujable si encuentra uno del tipo especificado en el
parametro c1
|
void |
setDrawableElements(List<DrawableElement> list)
Asigna una lista de elementos dibujables
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
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, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, 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
public static final int DEFAULT_CURSOR
public DefaultGCanvas(Color backgroundColor)
line
- Objeto líneabackgroundColor
- public void addBorder(int x1, int y1, int x2, int y2)
public void addValueChangedListener(IGCanvasListener listener)
addValueChangedListener
in interface GCanvas
listener
- public void removeValueChangedListener(IGCanvasListener listener)
removeValueChangedListener
in interface GCanvas
listener
- public void callDataChanged(String key, Object value)
callDataChanged
in interface GCanvas
public void callDataDragged(String key, Object value)
callDataDragged
in interface GCanvas
public void addDrawableElement(DrawableElement element)
addDrawableElement
in interface GCanvas
element
- public void replaceDrawableElement(DrawableElement element)
replaceDrawableElement
in interface GCanvas
element
- public void replaceDrawableElement(DrawableElement element, Class<?> cl)
replaceDrawableElement
in interface GCanvas
element
- c1
- public List<DrawableElement> getDrawableElements(Class<?> c1)
getDrawableElements
in interface GCanvas
c1
- public void removeDrawableElement(Class<?> cl)
removeDrawableElement
in interface GCanvas
Class
- clase del elemento a eliminarpublic void setDrawableElements(List<DrawableElement> list)
setDrawableElements
in interface GCanvas
public void paint(Graphics g)
paint
in interface GCanvas
paint
in class JComponent
public void execFirstDrawActions()
execFirstDrawActions
in interface GCanvas
public int getCanvasMinX()
getCanvasMinX
in interface GCanvas
public int getCanvasMinY()
getCanvasMinY
in interface GCanvas
public int getCanvasMaxX()
getCanvasMaxX
in interface GCanvas
public int getCanvasMaxY()
getCanvasMaxY
in interface GCanvas
public int getCanvasWidth()
getCanvasWidth
in interface GCanvas
public int getCanvasHeight()
getCanvasHeight
in interface GCanvas
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public boolean isMouse()
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public DrawableElement createBorderLayerForGCanvas(Color color)
GCanvas
createBorderLayerForGCanvas
in interface GCanvas
public InfoLayer createInfoLayerForGCanvas(Color colorLayer)
GCanvas
createInfoLayerForGCanvas
in interface GCanvas
public GraphicHistogram createHistogramForGCanvas(double[] data, Color color)
GCanvas
createHistogramForGCanvas
in interface GCanvas
public MinMaxLines createMinMaxLinesForGCanvas(Color color)
GCanvas
createMinMaxLinesForGCanvas
in interface GCanvas
public StraightLine createStraightLineForGCanvas(Color color)
GCanvas
createStraightLineForGCanvas
in interface GCanvas
public LogaritmicExponentialLine createLogaritmicExponentialLineForGCanvas(Color color, double point)
GCanvas
createLogaritmicExponentialLineForGCanvas
in interface GCanvas
public SquareRootPowLine createSquareRootPowLineForGCanvas(Color color, double point)
GCanvas
createSquareRootPowLineForGCanvas
in interface GCanvas
public DensitySlicingLine createDensitySliceForGCanvas(Color color, int levels)
GCanvas
createDensitySliceForGCanvas
in interface GCanvas