Package jadex.micro.examples.mandelbrot
Class DisplayPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- jadex.micro.examples.mandelbrot.DisplayPanel
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
public class DisplayPanel extends javax.swing.JComponent
Panel for displaying calculated results.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected IExternalAccess
agent
The service provider.protected boolean
calculating
Flag indicating that a calculation is in progress.protected java.awt.Color[]
colors
The colors for drawing.protected AreaData
data
The latest area data used for determining original coordinates of painted regions.protected java.lang.String
displayid
The display id.protected java.awt.Point
enddrag
End point for dragging (if any).static java.lang.String
HELPTEXT
The help text.protected java.awt.Image
image
The current image derived from the results.protected IMandelbrotService
manservice
The mandelbrot service.protected java.awt.Point
point
The current selection start point (if any).protected java.util.Map
progressdata
Progress data objects, available only when calculating (progress data -> percent finished).protected javax.swing.Timer
progressupdate
Progress update timer.protected java.awt.Rectangle
range
The current selection range (if any).protected java.awt.Point
startdrag
Start point for dragging (if any).-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description DisplayPanel(IExternalAccess agent, IMandelbrotService manservice)
Create a new display panel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProgress(ProgressData progress)
Display intermediate calculation results.protected void
calcArea(double x1, double x2, double y1, double y2, int sizex, int sizey)
Calculate the given area.protected void
calcDefaultImage()
Set display coordinates to default values.protected void
dragImage()
Drag the image according to current drag settings.protected java.awt.Rectangle
getInnerBounds(boolean scrollarea)
Get the bounds with respect to insets (if any).java.awt.Dimension
getMinimumSize()
Get the desired size of the panel.java.awt.Dimension
getPreferredSize()
Get the desired size of the panel.protected void
paintComponent(java.awt.Graphics g)
Paint the results.protected java.awt.Rectangle
scaleToFit(java.awt.Rectangle bounds, int iwidth, int iheight)
Calculate draw area for image.void
setColorScheme(java.awt.Color[] scheme, boolean cycle)
Set the color scheme.void
setResults(AreaData data)
Set new results.protected void
zoomImage(int x, int y, double factor)
Zoom into the given location by the given factor.protected void
zoomIntoRange()
Zoom into the selected range.-
Methods inherited from class javax.swing.JComponent
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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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, update, updateUI
-
Methods inherited from class java.awt.Container
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
-
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, 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
HELPTEXT
public static final java.lang.String HELPTEXT
The help text.- See Also:
- Constant Field Values
-
agent
protected IExternalAccess agent
The service provider.
-
manservice
protected IMandelbrotService manservice
The mandelbrot service.
-
colors
protected java.awt.Color[] colors
The colors for drawing.
-
data
protected AreaData data
The latest area data used for determining original coordinates of painted regions.
-
image
protected java.awt.Image image
The current image derived from the results.
-
point
protected java.awt.Point point
The current selection start point (if any).
-
range
protected java.awt.Rectangle range
The current selection range (if any).
-
calculating
protected boolean calculating
Flag indicating that a calculation is in progress.
-
progressdata
protected java.util.Map progressdata
Progress data objects, available only when calculating (progress data -> percent finished).
-
progressupdate
protected javax.swing.Timer progressupdate
Progress update timer.
-
startdrag
protected java.awt.Point startdrag
Start point for dragging (if any).
-
enddrag
protected java.awt.Point enddrag
End point for dragging (if any).
-
displayid
protected java.lang.String displayid
The display id.
-
-
Constructor Detail
-
DisplayPanel
public DisplayPanel(IExternalAccess agent, IMandelbrotService manservice)
Create a new display panel.
-
-
Method Detail
-
setResults
public void setResults(AreaData data)
Set new results.
-
addProgress
public void addProgress(ProgressData progress)
Display intermediate calculation results.
-
paintComponent
protected void paintComponent(java.awt.Graphics g)
Paint the results.- Overrides:
paintComponent
in classjavax.swing.JComponent
-
scaleToFit
protected java.awt.Rectangle scaleToFit(java.awt.Rectangle bounds, int iwidth, int iheight)
Calculate draw area for image.
-
getInnerBounds
protected java.awt.Rectangle getInnerBounds(boolean scrollarea)
Get the bounds with respect to insets (if any).- Parameters:
scrollarea
- True when inner bounds of scroll area instead of visible window space should be considered.
-
getMinimumSize
public java.awt.Dimension getMinimumSize()
Get the desired size of the panel.- Overrides:
getMinimumSize
in classjavax.swing.JComponent
-
getPreferredSize
public java.awt.Dimension getPreferredSize()
Get the desired size of the panel.- Overrides:
getPreferredSize
in classjavax.swing.JComponent
-
setColorScheme
public void setColorScheme(java.awt.Color[] scheme, boolean cycle)
Set the color scheme.
-
dragImage
protected void dragImage()
Drag the image according to current drag settings.
-
zoomImage
protected void zoomImage(int x, int y, double factor)
Zoom into the given location by the given factor.
-
calcDefaultImage
protected void calcDefaultImage()
Set display coordinates to default values.
-
zoomIntoRange
protected void zoomIntoRange()
Zoom into the selected range.
-
calcArea
protected void calcArea(double x1, double x2, double y1, double y2, int sizex, int sizey)
Calculate the given area.
-
-