public class Tableau extends JComponent implements MouseListener, MouseMotionListener, Serializable
JComponent
(and hence a
Component
), enhanced by some features:ImageInfo
object, Paintable
objects
assigned to a given spot and dimension within the image. Such element
is once or multiple times tight to the image with
Anchor
objects.Anchor
,
Paintable
, Element
and Listener
.paintable
elements
and forwarding the event, with element
and
anchor
to a registered Tableau.Listener
.ImageInfo
object.Anchor
is an inner class of Tableau. A
Tableau.Anchor
object hence knows its Tableau
object and moors one Paintable
in it.Tableau
processes mouse events and assigns them to moored
Paintable
objects, within the dimensions of wich the mouse
was.Tableau.Listener
.Tableau.Element
is an implementation of
Paintable
that may be extended. Even as is, it can act as
respectively replace Labels and Buttons.Tableau
organises its presentment as a sequence of pictures
starting withviaimgPBg
, modifiable for mid term changesimgDBu
, internal use only, serving for flicker free
presentmentPaintable
objects
(mostly on screen) via a Graphics
object provided by
the run timeextraPaint()
.copyImage()
or by
copyImageInfo()
, be extracted as copy.Modifier and Type | Class and Description |
---|---|
class |
Tableau.Anchor
The anchorage of a Paintable element in the Tableau.
|
static class |
Tableau.Element
An element paintable and "moorable" (fixable) within a tableau.
|
static interface |
Tableau.Listener
Information on control actions within the Tableau (by mouse).
|
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected Tableau.Anchor[] |
anchorList
The List (set) of moored Elements.
|
protected Graphics |
grDBu
The double buffer image's graphic context.
|
protected Graphics |
grPBg
The permanent background image's graphic context.
|
protected ImageInfo |
img
The optional background image.
|
protected BufferedImage |
imgDBu
The double buffer image.
|
protected BufferedImage |
imgPBg
The background as image (colour + optional image).
|
protected static Tableau |
lastTableau
The Tableau last made.
|
static Tableau.Anchor[] |
NO_ANCHOR
Empty array of Anchor.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
Tableau(Color bgColor,
int width,
int heigth)
Constructor with background colour und size.
|
Tableau(Color bgColor,
String imgFile)
Constructor with background colour and background image.
|
Tableau(Color bgColor,
String imgFile,
Class<?> klass,
int oR,
int uR,
int lR,
int rR)
Constructor with background colour, background image and margins.
|
Tableau(Color bgColor,
String imgFile,
int oR,
int uR,
int lR,
int rR)
Constructor with background colour, background image and margins.
|
Tableau(Color bgColor,
String imgFile,
Prop prop,
int oR,
int uR,
int lR,
int rR)
Constructor with background colour, background image and margins.
|
Modifier and Type | Method and Description |
---|---|
void |
addAnchor(Tableau.Anchor a)
Add one Anchor.
|
void |
addAnchor(Tableau.Anchor[] aa)
Add multiple Anchors.
|
void |
addAnchorReverse(Tableau.Anchor[] aa)
Add multiple Anchors.
|
void |
addListener(Tableau.Listener l)
Set a Tableau listener.
|
void |
clearAnchor()
Clear all Anchors.
|
boolean |
contains(Tableau.Anchor a)
Check if an Anchor is moored in this Tableau.
|
BufferedImage |
copyImage()
Copy the Tableau's actual content.
|
ImageInfo |
copyImageInfo()
Copy the actual Tableau content.
|
void |
ensureCapacity(int absMin,
int minInc)
Ensure or increase the Anchor list's reserve capacity.
|
void |
extraPaint(Graphics g,
boolean beforElements)
Paint method.
|
float |
getAlignmentX()
Get the preferred X alignment (0.5F).
|
float |
getAlignmentY()
Get the preferred Y alignment (0.5F).
|
int |
getAnchorCount()
Number of Anchor objects.
|
Tableau.Anchor[] |
getAnchorInside(Point p1,
Point p2)
Get all Anchors within a range.
|
Tableau.Anchor[] |
getAnchorListe()
Get the complete list of Anchor objects.
|
int |
getHeight()
The Tableau's height.
|
Dimension |
getMaximumSize()
Get the maximal size.
|
Dimension |
getMinimumSize()
Get the minimal size.
|
Graphics |
getPermBgGraphics()
The permanent background's graphic context.
|
Dimension |
getPreferredSize()
Get the preferred size.
|
int |
getWidth()
The Tableau's width.
|
boolean |
isGrid()
An auxiliary grid (raster 10 pixel) shall be painted.
|
void |
mouseClicked(MouseEvent m)
Mouse clicked.
|
void |
mouseDragged(MouseEvent m)
Mouse dragged (moved with key pressed).
|
void |
mouseEntered(MouseEvent m)
Mouse entered.
|
void |
mouseExited(MouseEvent m)
Mouse exited.
|
void |
mouseMoved(MouseEvent m)
Mouse moved.
|
void |
mousePressed(MouseEvent m)
Mouse pressed.
|
void |
mouseReleased(MouseEvent m)
Mouse released.
|
void |
paint(Graphics g)
Paint method.
|
void |
removeAnchor(Tableau.Anchor a)
Remove an Anchor.
|
void |
restorePermBg()
Re-making the permanent background.
|
void |
retouche(Graphics g,
int width,
int height)
One time change (retouching) the loaded and margined Tableau.
|
void |
setGrid(boolean grid)
An auxiliary grid (raster 10 pixel) shall be painted.
|
void |
setMotion(boolean motion)
Mouse motion shall be used or not.
|
void |
setSize(Dimension d)
Set the size.
|
void |
trimToSize()
Remove the Anchor list's reserve capacity empty.
|
void |
update(Graphics g)
Update method.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateUI
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, getAccessibleContext, 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, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected static Tableau lastTableau
Tableau
object referred to ba lastTableau
will be
used by some Tableau.Element
constructors for
mooring the new element there with spot and dimension.Tableau
object with all moored
elements
in one run (single threaded) and then serialises
it for later use in the target (automation) application.protected ImageInfo img
setBackground()
) determines the
so called permanent background image. Tableau
's size.setSize(Dimension)
protected transient BufferedImage imgPBg
getPermBgGraphics()
be retouched or reset by
restorePermBg()
to the construction state.restorePermBg()
. Than only it may be manipulated via
getPermBgGraphics()
.protected transient Graphics grPBg
protected transient BufferedImage imgDBu
Tableau.paint()
and Tableau.update()
do
paint the permanent background image imgPBg
an all moored
Paintable Elements at first on the double buffer image. Afterwards in
one beat and without clearing the background the whole bunch will be
painted to the target graphic context. On a target (Tableau) screen
one sees just the changes without flicker.copyImageInfo()
, got
as copy.protected transient Graphics grDBu
protected Tableau.Anchor[] anchorList
public static final Tableau.Anchor[] NO_ANCHOR
public Tableau(Color bgColor, int width, int heigth)
bgColor
- background colourwidth
- Tableau's widthheigth
- Tableau's heightpublic Tableau(Color bgColor, String imgFile)
imgFile
- file name (.gif, .png oder .jpg) of background imagesbgColor
- colour for background and or margins (default ws/white).NoSuchElementException
- if no file can be loadedpublic Tableau(Color bgColor, String imgFile, int oR, int uR, int lR, int rR)
img
will be made in that size (from imgFile and
the margins given). Under this construction the Tableau img
may
be retouched once by the method retouche()
. The image
made so will be the part of a Tableau object's serialisation state and is
the blue print for the permanent background image imgPBg
.Tableau(bgColor, imgFile, null, oR, uR, lR, rR)
.imgFile
- file name (.gif, .png oder .jpg) of background imagesbgColor
- colour for background and or margins (default ws/white).oR
- upper margin in pixel (0..400).uR
- lR - rR - dto. low (unten), left and right.NoSuchElementException
- if no file can be loadedGrafHelper.surrondImage()
public Tableau(Color bgColor, String imgFile, Prop prop, int oR, int uR, int lR, int rR)
Prop
parameter prop.Prop.getAsStream()
. By this
one could get is as resource from the application's .jar file.
Additionally an image file name not given by parameter imgFile will be
determined by the property bgFile in prop.imgFile
- file name (.gif, .png oder .jpg) of background imagesbgColor
- colour for background and or margins (default ws/white).prop
- A Prop object as has to find values and resources.oR
- upper margin in pixel (0..400).uR
- lR - rR - dto low (unten), left and right.NoSuchElementException
- if no file or ressource can be
loadedGrafHelper.surrondImage()
public Tableau(Color bgColor, String imgFile, Class<?> klass, int oR, int uR, int lR, int rR)
Prop.getAsStream()
. By this
one could get is as resource from the application's .jar file.
Additionally an image file name not given by parameter imgFile will be
determined by the property bgFile in prop.imgFile
- file name (.gif, .png oder .jpg) of background imagesbgColor
- colour for background and or margins (default ws/white).klass
- A Class object to find resources.oR
- upper margin in pixel (0..400).uR
- lR - rR - dto low (unten), left and right.NoSuchElementException
- if no file or ressource can be
loadedGrafHelper.surrondImage()
public final void setSize(Dimension d)
public final int getWidth()
getWidth
in class JComponent
public final int getHeight()
getHeight
in class JComponent
public final int getAnchorCount()
public final boolean contains(Tableau.Anchor a)
public final void addAnchor(Tableau.Anchor a)
public final void ensureCapacity(int absMin, int minInc)
absMin
- Minimal required capacity (absolut)minInc
- Minimal required capacity increase relative to the
actual (anchorageCount
)public final void trimToSize()
public final void addAnchor(Tableau.Anchor[] aa)
aa
- Ein Feld von AnchoraddAnchor(Tableau.Anchor)
,
addAnchorReverse(Tableau.Anchor[])
,
removeAnchor(Tableau.Anchor)
public final void addAnchorReverse(Tableau.Anchor[] aa)
aa
- an array of Anchor objectsaddAnchor(Tableau.Anchor)
,
addAnchor(Tableau.Anchor[])
,
removeAnchor(Tableau.Anchor)
public final void removeAnchor(Tableau.Anchor a)
addAnchor(Tableau.Anchor)
,
clearAnchor()
public final void clearAnchor()
public final Tableau.Anchor[] getAnchorListe()
clearAnchor()
,
addAnchor(Tableau.Anchor)
public Tableau.Anchor[] getAnchorInside(Point p1, Point p2)
p1
- left upper; default (0, 0)p2
- right lower; default the Tableau's dimensionpublic final boolean isGrid()
img
the auxiliary grid
will be within the margins only. The raster's upper left corner is
(ImageInfo.leM
,
ImageInfo.upM
).ImageInfo.surrondImage()
,
setGrid()
public void setGrid(boolean grid)
isGrid()
public void retouche(Graphics g, int width, int height)
g
- Malen in img
width
- width in pixelsheight
- height in pixelspublic final Dimension getPreferredSize()
getPreferredSize()
, getMaximumSize()
and getMinimumSize()
return the same size set at construction.
(see img
).getPreferredSize
in class JComponent
getHeight()
,
getWidth()
public final Dimension getMinimumSize()
getMinimumSize
in class JComponent
getPreferredSize()
public final Dimension getMaximumSize()
getMaximumSize
in class JComponent
getPreferredSize()
public float getAlignmentX()
getAlignmentX
in class JComponent
public float getAlignmentY()
getAlignmentY
in class JComponent
public final void update(Graphics g)
paint()
.update
in class JComponent
public final BufferedImage copyImage()
BufferedImage
object. The content will be the same
as the last double buffer image imgDBu
shown by this
Tableau.copyImageInfo()
public final ImageInfo copyImageInfo()
ImageInfo
object getting the same information on margins, filename etc. as
img
. The content will be the same as the last double
buffer image imgDBu
shown by this Tableau.copyImage()
public Graphics getPermBgGraphics()
imgPBg
in an arbitrary way. Synchronising this
manipulation with other activities concerning the Tableau is the
user's responsibility.
public void restorePermBg()
img
) on next paint()
,
update()
or getPermBgGraphics()
.public final void paint(Graphics g)
Paintable
elements.Paintable
elements
Paintable.paint()
methods. Hence to protect this
internal organisation this method and
update()
cannot be overridden (final).extraPaint()
.paint
in class JComponent
public void extraPaint(Graphics g, boolean beforElements)
public final void addListener(Tableau.Listener l)
public final void setMotion(boolean motion)
motion
- true: mouse motions will be captured and forwarded;public final void mouseEntered(MouseEvent m)
mouseEntered
in interface MouseListener
public final void mouseExited(MouseEvent m)
mouseExited
in interface MouseListener
public final void mouseMoved(MouseEvent m)
mouseMoved
in interface MouseMotionListener
public final void mouseDragged(MouseEvent m)
mouseDragged
in interface MouseMotionListener
public final void mouseClicked(MouseEvent m)
mouseClicked
in interface MouseListener
public final void mousePressed(MouseEvent m)
mousePressed
in interface MouseListener
public final void mouseReleased(MouseEvent m)
mouseReleased
in interface MouseListener