FEJDGui
Class MatrixPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byFEJDGui.MatrixPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class MatrixPanel
extends javax.swing.JPanel

This panel displays the matrix with the painted elements

See Also:
Serialized Form

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  boolean all
          True if the whole panel has to be painted (to create a jpeg for exemple)
private  boolean isDispDecomp
          Keeps the choice of the user about the displaying of the LU decomposition
private  int margin
          The margin around the matrix
private  java.util.Vector matBlue
          Contains non zero elements of the matrix
private  java.util.Vector matDecompBlue
          Contains non zero elements of the LU matrix after decomposition
private  java.util.Vector matGreen
          Contains the elements of the matrix corresponding to dirichlet nodes
private  java.util.Vector matGreenTmp
          Contains the row and the column of the current dirichlet point
private  java.util.Vector matRed
          Contains the non zero elements of the matrix added by the current element
private  java.util.Vector matRedTmp
          Contains the row and the column of the current highlighted row, for the display of the solving process
private  int size
          The size of the displayed matrix
private  java.util.Vector vectBlue
          Contains non zero elements of the vector
private  java.util.Vector vectGreen
          Contains the elements of the vector corresponding to dirichlet nodes
private  java.util.Vector vectRed
          Contains the non zero elements of the vector added by the current element
private  int zoomValue
          The current value of the zoom
 
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
MatrixPanel()
          Construts and initialises a new matrix panel
 
Method Summary
 void changeDispDecomp()
          Switches between displaying and not displaying the LU matrix
 void clearGreenTmp()
          Clears the matrix containing temporary green points
 void clearRedTmp()
          Clears the matrix containing temporary red points
 void emptyMat()
          Clears the matrices containing colored points
 void emptyVect()
          Clears the vectors containing colored elements
 boolean getDispDecomp()
          Returns true if the user wants to display the LU matrix
 int getMargin()
          Returns the margin of the panel
private  Vector2 getMatBlue(int i)
          Returns the ith blue element of the matrix
private  int getMatBlueSize()
          Returns the number of blue elements of the matrix
private  Vector2 getMatDecompBlue(int i)
          Returns the ith blue element of the LU matrix
private  int getMatDecompBlueSize()
          Returns the number of blue elements of the LU matrix
private  Vector2 getMatGreen(int i)
          Returns the ith green element of the matrix
private  int getMatGreenSize()
          Returns the number of green elements of the matrix
private  Vector2 getMatGreenTmp(int i)
          Returns the ith temporary green element of the matrix
private  int getMatGreenTmpSize()
          Returns the number of temporary green elements of the matrix
private  Vector2 getMatRed(int i)
          Returns the ith red element of the matrix
private  int getMatRedSize()
          Returns the number of red elements of the matrix
private  Vector2 getMatRedTmp(int i)
          Returns the ith temporary red element of the matrix
private  int getMatRedTmpSize()
          Returns the number of temporary red elements of the matrix
 int getSizeMat()
          Returns the size of the matrix
private  int getVectBlue(int i)
          Returns the ith blue element of the vector
private  int getVectBlueSize()
          Returns the number of blue elements of the vector
private  int getVectGreen(int i)
          Returns the ith green element of the vector
private  int getVectGreenSize()
          Returns the number of green elements of the vector
private  int getVectRed(int i)
          Returns the ith red element of the vector
private  int getVectRedSize()
          Returns the number of green elements of the vector
 void insertMat()
          Changes all the red point of the matrix to blue points
 void insertVect()
          Changes all the red point of the vector to blue elements
 boolean isCrossDisplayed(int i, int j)
          Returns true if any portion of the row i and the column j is displayed by the scroll pane
 boolean isElemDisplayed(int i, int j)
          Returns true if the element (i,j) of the matrix is displayed by the scroll pane
 void loadDecomp(SkyLine SMatrix)
          Loads the LU decomposition of the matrix
 void paintComponent(java.awt.Graphics g)
          Paints the components of the display
private  void printValue(java.awt.Graphics g, int ni, int nj, int xd, int yd, java.awt.Color col, int asc, java.awt.FontMetrics fm, boolean symetric)
          Prints the value of the element of the matrix
private  void printVectValue(java.awt.Graphics g, int nbr, int xd, int yd, java.awt.Color col, int asc, java.awt.FontMetrics fm)
          Prints the value of the element of the vector
 void recalcPanelSize(int value)
          Recomputes the size of the matrix when the scroll bar is moved
 void setMatGreen(int i, int j)
          Sets (i,j) as green element of the matrix
 void setMatGreenTmp(int i, int j)
          Sets (i,j) as temporary green element of the matrix
 void setMatRed(int i, int j)
          Sets (i,j) as red element of the matrix
 void setMatRedTmp(int i, int j)
          Sets (i,j) as temporary red element of the matrix
 void setMesh(int size)
          Sets the mesh so its matrix can be displayed
 void setVectGreen(int i)
          Sets i as green element of the vector
 void setVectRed(int i)
          Sets i as red element of the vector
 void willPaintAll()
          Turns the all variable to true
 
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, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, 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, 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isDispDecomp

private boolean isDispDecomp
Keeps the choice of the user about the displaying of the LU decomposition


vectBlue

private java.util.Vector vectBlue
Contains non zero elements of the vector


vectRed

private java.util.Vector vectRed
Contains the non zero elements of the vector added by the current element


vectGreen

private java.util.Vector vectGreen
Contains the elements of the vector corresponding to dirichlet nodes


matBlue

private java.util.Vector matBlue
Contains non zero elements of the matrix


matDecompBlue

private java.util.Vector matDecompBlue
Contains non zero elements of the LU matrix after decomposition


matRed

private java.util.Vector matRed
Contains the non zero elements of the matrix added by the current element


matGreen

private java.util.Vector matGreen
Contains the elements of the matrix corresponding to dirichlet nodes


matGreenTmp

private java.util.Vector matGreenTmp
Contains the row and the column of the current dirichlet point


matRedTmp

private java.util.Vector matRedTmp
Contains the row and the column of the current highlighted row, for the display of the solving process


margin

private int margin
The margin around the matrix


zoomValue

private int zoomValue
The current value of the zoom


size

private int size
The size of the displayed matrix


all

private boolean all
True if the whole panel has to be painted (to create a jpeg for exemple)

Constructor Detail

MatrixPanel

public MatrixPanel()
Construts and initialises a new matrix panel

Method Detail

setMesh

public void setMesh(int size)
Sets the mesh so its matrix can be displayed


setMatRed

public void setMatRed(int i,
                      int j)
Sets (i,j) as red element of the matrix


getMatRed

private Vector2 getMatRed(int i)
Returns the ith red element of the matrix


getMatBlue

private Vector2 getMatBlue(int i)
Returns the ith blue element of the matrix


getMatDecompBlue

private Vector2 getMatDecompBlue(int i)
Returns the ith blue element of the LU matrix


setMatGreen

public void setMatGreen(int i,
                        int j)
Sets (i,j) as green element of the matrix


setMatGreenTmp

public void setMatGreenTmp(int i,
                           int j)
Sets (i,j) as temporary green element of the matrix


setMatRedTmp

public void setMatRedTmp(int i,
                         int j)
Sets (i,j) as temporary red element of the matrix


getMatGreen

private Vector2 getMatGreen(int i)
Returns the ith green element of the matrix


getMatRedTmp

private Vector2 getMatRedTmp(int i)
Returns the ith temporary red element of the matrix


getMatGreenTmp

private Vector2 getMatGreenTmp(int i)
Returns the ith temporary green element of the matrix


getMatRedSize

private int getMatRedSize()
Returns the number of red elements of the matrix


getMatBlueSize

private int getMatBlueSize()
Returns the number of blue elements of the matrix


getMatDecompBlueSize

private int getMatDecompBlueSize()
Returns the number of blue elements of the LU matrix


getMatGreenSize

private int getMatGreenSize()
Returns the number of green elements of the matrix


getMatGreenTmpSize

private int getMatGreenTmpSize()
Returns the number of temporary green elements of the matrix


getMatRedTmpSize

private int getMatRedTmpSize()
Returns the number of temporary red elements of the matrix


emptyMat

public void emptyMat()
Clears the matrices containing colored points


clearGreenTmp

public void clearGreenTmp()
Clears the matrix containing temporary green points


clearRedTmp

public void clearRedTmp()
Clears the matrix containing temporary red points


insertMat

public void insertMat()
Changes all the red point of the matrix to blue points


setVectRed

public void setVectRed(int i)
Sets i as red element of the vector


getVectRed

private int getVectRed(int i)
Returns the ith red element of the vector


getVectBlue

private int getVectBlue(int i)
Returns the ith blue element of the vector


setVectGreen

public void setVectGreen(int i)
Sets i as green element of the vector


getVectGreen

private int getVectGreen(int i)
Returns the ith green element of the vector


getVectRedSize

private int getVectRedSize()
Returns the number of green elements of the vector


getVectBlueSize

private int getVectBlueSize()
Returns the number of blue elements of the vector


getVectGreenSize

private int getVectGreenSize()
Returns the number of green elements of the vector


emptyVect

public void emptyVect()
Clears the vectors containing colored elements


insertVect

public void insertVect()
Changes all the red point of the vector to blue elements


getSizeMat

public int getSizeMat()
Returns the size of the matrix


loadDecomp

public void loadDecomp(SkyLine SMatrix)
Loads the LU decomposition of the matrix


isElemDisplayed

public boolean isElemDisplayed(int i,
                               int j)
Returns true if the element (i,j) of the matrix is displayed by the scroll pane


isCrossDisplayed

public boolean isCrossDisplayed(int i,
                                int j)
Returns true if any portion of the row i and the column j is displayed by the scroll pane


recalcPanelSize

public void recalcPanelSize(int value)
Recomputes the size of the matrix when the scroll bar is moved


changeDispDecomp

public void changeDispDecomp()
Switches between displaying and not displaying the LU matrix


getDispDecomp

public boolean getDispDecomp()
Returns true if the user wants to display the LU matrix


getMargin

public int getMargin()
Returns the margin of the panel


printValue

private void printValue(java.awt.Graphics g,
                        int ni,
                        int nj,
                        int xd,
                        int yd,
                        java.awt.Color col,
                        int asc,
                        java.awt.FontMetrics fm,
                        boolean symetric)
Prints the value of the element of the matrix


printVectValue

private void printVectValue(java.awt.Graphics g,
                            int nbr,
                            int xd,
                            int yd,
                            java.awt.Color col,
                            int asc,
                            java.awt.FontMetrics fm)
Prints the value of the element of the vector


willPaintAll

public void willPaintAll()
Turns the all variable to true


paintComponent

public void paintComponent(java.awt.Graphics g)
Paints the components of the display