public class DrawingPanel extends javax.swing.JPanel implements java.awt.event.ActionListener, Renderable
Modifier and Type | Class and Description |
---|---|
class |
DrawingPanel.ZoomBox
ZoomBox creates an on-screen rectangle using XORMode for fast redrawing.
|
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected boolean |
adjustableGutter |
protected boolean |
antialiasShapeOn |
protected boolean |
antialiasTextOn |
protected double |
autoscaleMargin |
protected boolean |
autoscaleX |
protected boolean |
autoscaleY |
protected java.awt.Color |
bgColor |
protected TextPanel |
blMessageBox |
static int |
BOTTOM_LEFT
Message box location
|
static int |
BOTTOM_RIGHT
Message box location
|
protected int |
bottomGutter |
protected int |
bottomGutterPreferred |
protected TextPanel |
brMessageBox |
protected boolean |
clipAtGutter |
protected CoordinateStringBuilder |
coordinateStrBuilder |
protected java.awt.Window |
customInspector |
protected java.text.DecimalFormat |
decimalFormat |
protected Dimensioned |
dimensionSetter |
protected java.util.ArrayList |
drawableList |
protected boolean |
enableZoom |
protected boolean |
fixedPixelPerUnit |
protected org.opensourcephysics.display.DrawingPanel.GlassPanel |
glassPanel |
protected OSPLayout |
glassPanelLayout |
protected int |
height |
protected int |
leftGutter |
protected int |
leftGutterPreferred |
protected MouseController |
mouseController |
protected java.awt.image.BufferedImage |
offscreenImage |
protected org.opensourcephysics.display.DrawingPanel.OptionController |
optionController |
protected double[] |
pixelMatrix |
protected java.awt.geom.AffineTransform |
pixelTransform |
protected javax.swing.JPopupMenu |
popupmenu |
protected javax.swing.JMenuItem |
propertiesItem |
protected int |
rightGutter |
protected int |
rightGutterPreferred |
protected javax.swing.JMenuItem |
scaleItem |
protected java.text.DecimalFormat |
scientificFormat |
protected boolean |
showCoordinates |
protected javax.swing.JMenuItem |
snapshotItem |
protected boolean |
squareAspect |
protected TextPanel |
tlMessageBox |
static int |
TOP_LEFT
Message box location
|
static int |
TOP_RIGHT
Message box location
|
protected int |
topGutter |
protected int |
topGutterPreferred |
protected TextPanel |
trMessageBox |
protected boolean |
validImage |
protected java.awt.Rectangle |
viewRect |
protected int |
width |
protected java.awt.image.BufferedImage |
workingImage |
protected double |
xceil |
protected double |
xfloor |
protected double |
xMarginPercentage |
protected double |
xmax |
protected double |
xmaxPreferred |
protected double |
xmin |
protected double |
xminPreferred |
protected double |
xPixPerUnit |
protected double |
yceil |
protected double |
yfloor |
protected double |
yMarginPercentage |
protected double |
ymax |
protected double |
ymaxPreferred |
protected double |
ymin |
protected double |
yminPreferred |
protected double |
yPixPerUnit |
protected DrawingPanel.ZoomBox |
zoomBox |
protected javax.swing.JMenuItem |
zoomInItem |
protected boolean |
zoomMode |
protected javax.swing.JMenuItem |
zoomOutItem |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
DrawingPanel()
DrawingPanel constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent evt)
Performs the action for the refresh timer by refreshing the data in the DataTable.
|
void |
addDrawable(Drawable drawable)
Adds a drawable object to the drawable list.
|
void |
addDrawables(java.util.Collection drawables)
Adds a collection of drawable objects to the drawable list.
|
protected void |
buildPopupmenu()
Builds the default popup menu for this panel.
|
protected boolean |
checkWorkingImage()
Checks the image to see if the working image has the correct Dimension.
|
void |
clear()
Removes all drawable objects from the drawable list.
|
protected void |
computeGutters()
Computes the size of the gutters.
|
void |
enableInspector(boolean isEnabled)
Enables the popup inspector option.
|
protected java.awt.Rectangle |
findViewRect()
Finds the clipping rectangle if this panel is within a scroll pane viewport.
|
double |
getAspectRatio()
Gets the ratio of pixels per unit in the x and y directions.
|
int |
getBottomGutter()
Gets the bottom gutter of this DrawingPanel.
|
CoordinateStringBuilder |
getCoordinateStringBuilder()
Gets the CoordinateStringBuilder that converts mouse events into a string showing world coordinates.
|
Dimensioned |
getDimensionSetter()
Gets the object that sets the gutters for this panel.
|
java.util.ArrayList |
getDrawables()
Gets the cloned list of Drawable objects.
|
java.util.ArrayList |
getDrawables(java.lang.Class c)
Gets Drawable objects of an assignable type.
|
javax.swing.JPanel |
getGlassPanel()
Gets the glass panel.
|
int[] |
getGutters()
Gets the gutters.
|
int |
getHeight() |
double |
getImageRatio()
Gets the ratio of the drawing image to the panel.
|
int |
getLeftGutter()
Gets the left gutter of this DrawingPanel.
|
static XML.ObjectLoader |
getLoader()
Returns an XML.ObjectLoader to save and load object data.
|
double |
getMaxPixPerUnit()
Gets the larger of x or y pixels per world unit.
|
java.awt.geom.Rectangle2D |
getMeasure()
Gets the rectangle that bounds all measurable objects.
|
java.util.ArrayList |
getObjectOfClass(java.lang.Class c)
Gets objects of a specific class from the drawables list.
|
double[] |
getPixelMatrix()
Retrieves the 6 specifiable values in the pixel transformation
matrix and places them into an array of double precisions values.
|
java.awt.geom.AffineTransform |
getPixelTransform()
Gets the affine transformation that converts from world to pixel coordinates.
|
javax.swing.JPopupMenu |
getPopupMenu()
Gets the popup menu.
|
double |
getPreferredXMax()
Gets the preferred x world coordinate for the right-hand side of the drawing area.
|
double |
getPreferredXMin()
Gets the preferred x world coordinate for the left-hand side of the drawing area.
|
double |
getPreferredYMax()
Gets the preferred y world coordinate for the top of the drawing area.
|
double |
getPreferredYMin()
Gets the preferred y world coordinate for the bottom of the drawing area.
|
int |
getRightGutter()
Gets the right gutter of this DrawingPanel.
|
java.awt.geom.Rectangle2D |
getScale()
Gets the scale that will be used when the panel is drawn.
|
int |
getTopGutter()
Gets the bottom gutter of this DrawingPanel.
|
VideoTool |
getVideoTool()
Gets the video capture tool.
|
protected java.awt.Rectangle |
getViewRect()
Gets the clipping rectance within a scroll pane viewport.
|
int |
getWidth() |
double |
getXMax()
Gets the x world coordinate for the right-hand side of the drawing area.
|
double |
getXMin()
Gets the x world coordinate for the left-hand side of the drawing area.
|
double |
getXPixPerUnit()
Gets the number of pixels per world unit in the x direction.
|
double |
getYMax()
Gets the y world coordinate for the top of the drawing area.
|
double |
getYMin()
Gets the y world coordinate for the bottom of the drawing area.
|
double |
getYPixPerUnit()
Gets the number of pixels per world unit in the y direction.
|
DrawingPanel.ZoomBox |
getZoomBox()
Returns the internal ZoomBox object
|
boolean |
hasInspector()
Determines if the user can examine and change the scale at run-time by right-clicking.
|
void |
hideInspector()
Hides the drawing panel properties inspector.
|
void |
invalidateImage()
Invalidate the offscreen image so that it is rendered during the next repaint operation if buffering is enabled.
|
boolean |
isAdjustableGutter()
Gets the adjustableGutter flag.
|
boolean |
isAntialiasShapeOn()
Gets flag for shape antialiasing.
|
boolean |
isAntialiasTextOn()
Gets flag for text antialiasing.
|
boolean |
isAutoscaleX()
Determines if the x axis autoscale property is true.
|
boolean |
isAutoscaleY()
Determines if the y axis autoscale property is true.
|
boolean |
isBuffered() |
boolean |
isClipAtGutter()
Gets the clip at gutter flag.
|
boolean |
isIconified()
Gets the iconified flag from the top level frame.
|
boolean |
isPointInside(double x,
double y)
Determines if the x and y point is inside.
|
boolean |
isSquareAspect()
Determines if the number of pixels per unit is the same for both x and y.
|
boolean |
isZoom()
Determines if the user can change scale by dragging the mouse.
|
void |
limitAutoscaleX(double floor,
double ceil)
Limits the xmin and xmax values during autoscaling so that the mininimum value
will be no greater than the floor and the maximum value will be no
smaller than the ceil.
|
void |
limitAutoscaleY(double floor,
double ceil)
Limits ymin and ymax values during autoscaling so that the mininimum value
will be no greater than the floor and the maximum value will be no
smaller than the ceil.
|
void |
measure()
Sets the scale based on the max and min values of all measurable objects.
|
void |
paint(java.awt.Graphics g) |
void |
paintComponent(java.awt.Graphics g)
Paints this component.
|
protected void |
paintDrawableList(java.awt.Graphics g,
java.util.ArrayList tempList)
Paints all the drawable objects in the panel.
|
protected void |
paintEverything(java.awt.Graphics g)
Paints everything inside this component.
|
protected void |
paintFirst(java.awt.Graphics g)
Paints before the panel iterates through its list of Drawables.
|
protected void |
paintLast(java.awt.Graphics g)
Paints after the panel iterates through its list of Drawables.
|
double |
pixToX(int pix)
Converts pixel to x world units.
|
double |
pixToY(int pix)
Converts pixel to x world units.
|
double[] |
project(double[] coordinate,
double[] pixel)
Projects a 2D or 3D world coordinate to a pixel coordinate.
|
void |
recomputeTransform()
Recomputes the pixel transforamtion based on the current minimum and maximum values and the gutters.
|
protected void |
refreshGUI()
Refreshes the user interface in response to display changes such as Language.
|
void |
removeDrawable(Drawable drawable)
Removes a drawable object from the drawable list.
|
void |
removeDrawables(java.lang.Class c)
Removes all objects assignable to the given class from the drawable list.
|
void |
removeObjectsOfClass(java.lang.Class c)
Removes all objects of the given class from the drawable list.
|
void |
removeOptionController()
Removes the option controller.
|
java.awt.image.BufferedImage |
render()
Paints all drawables onto an offscreen image buffer and copies this image onto the screen.
|
java.awt.image.BufferedImage |
render(java.awt.image.BufferedImage image)
Paints all drawables onto an image.
|
void |
replaceDrawable(Drawable oldDrawable,
Drawable newDrawable)
Replaces a drawable object with another drawable.
|
void |
resetGutters()
Resets the gutters to their preferred values.
|
void |
scale()
Sets axis scales if autoscale is true using the max and min values of the measurable objects.
|
protected void |
scale(java.util.ArrayList tempList)
Sets axis scales if autoscale is true using the max and min values of the objects in the given list.
|
protected void |
scaleX()
Sets the x axis scale based on the max and min values of all measurable objects.
|
protected void |
scaleY()
Sets the y axis scale based on the max and min values of all measurable objects.
|
void |
setAdjustableGutter(boolean adjustable)
Sets adjustable gutters.
|
void |
setAntialiasShapeOn(boolean on)
Set flag for shape antialiasing.
|
void |
setAntialiasTextOn(boolean on)
Set flag for text antialiasing.
|
void |
setAutoscaleMargin(double _autoscaleMargin)
Sets the size of the margin during an autoscale operation.
|
void |
setAutoscaleX(boolean autoscale)
Autoscale the x axis using min and max values.
|
void |
setAutoscaleY(boolean autoscale)
Autoscale the y axis using min and max values.
|
void |
setBounds(int x,
int y,
int width,
int height)
Moves and resizes this component.
|
void |
setBounds(java.awt.Rectangle r) |
void |
setBuffered(boolean _buffered)
Sets the buffered image option.
|
void |
setClipAtGutter(boolean clip)
Sets the panel to exclude the gutter from the drawing.
|
void |
setCoordinateStringBuilder(CoordinateStringBuilder builder)
Sets the CoordinateStringBuilder that converts mouse events into a string showing world coordinates.
|
void |
setCustomInspector(java.awt.Window w)
Sets a custom properties inspector window.
|
protected void |
setFontLevel(int level)
Sets the font level.
|
void |
setGutters(int[] gutters)
Sets the gutters using the given array.
|
void |
setGutters(int left,
int top,
int right,
int bottom)
Sets gutters around the drawing area.
|
void |
setIgnoreRepaint(boolean ignoreRepaint) |
void |
setMessage(java.lang.String msg)
Shows a message in a yellow text box in the lower right hand corner.
|
void |
setMessage(java.lang.String msg,
int location)
Shows a message in a yellow text box.
|
void |
setMouseCursor(java.awt.Cursor cursor)
Sets the mouse cursor.
|
void |
setPixelScale()
Calculates min and max values and the affine transformation based on the
current size of the panel and the squareAspect boolean.
|
void |
setPixelsPerUnit(boolean enable,
double xPixPerUnit,
double yPixPerUnit)
Sets the scale using pixels per unit.
|
void |
setPopupMenu(javax.swing.JPopupMenu menu)
Sets the popup menu.
|
void |
setPreferredGutters(int left,
int top,
int right,
int bottom)
Sets preferred gutters around the drawing area.
|
void |
setPreferredMinMax(double xmin,
double xmax,
double ymin,
double ymax)
Sets the preferred scale in the vertical and horizontal direction.
|
void |
setPreferredMinMaxX(double xmin,
double xmax)
Sets the preferred scale in the horizontal direction.
|
void |
setPreferredMinMaxY(double ymin,
double ymax)
Sets the preferred scale in the vertical direction.
|
void |
setShowCoordinates(boolean show)
Show the coordinates in the text box in the lower left hand corner.
|
void |
setSquareAspect(boolean val)
Sets the aspect ratio for horizontal to vertical to unity when
true<\code>. |
void |
setVideoTool(VideoTool videoCap)
Sets the video tool.
|
void |
setVisible(boolean isVisible)
Makes the component visible or invisible.
|
void |
setXMarginPercentage(double _percentage)
Sets the extra precentage on the X margin during an autoscale operation.
|
void |
setYMarginPercentage(double _percentage)
Sets the extra precentage on the Y margin during an autoscale operation.
|
void |
setZoom(boolean _enableZoom)
Sets the zoom option to allow the user to change scale by dragging the mouse while pressing the shift.
|
void |
showInspector()
Shows the drawing panel properties inspector.
|
void |
snapshot()
Creates a snapshot using an image of the content.
|
int |
xToPix(double x)
Converts x from world to pixel units.
|
int |
yToPix(double y)
Converts y from world to pixel units.
|
protected void |
zoomIn()
Zooms in on next click-drag.
|
protected void |
zoomOut()
Zooms out by increasing the preferred min/max values by a factor of two.
|
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, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, 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, 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, hide, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int BOTTOM_LEFT
public static final int BOTTOM_RIGHT
public static final int TOP_RIGHT
public static final int TOP_LEFT
protected javax.swing.JPopupMenu popupmenu
protected javax.swing.JMenuItem propertiesItem
protected javax.swing.JMenuItem scaleItem
protected javax.swing.JMenuItem zoomInItem
protected javax.swing.JMenuItem zoomOutItem
protected javax.swing.JMenuItem snapshotItem
protected int leftGutter
protected int topGutter
protected int rightGutter
protected int bottomGutter
protected int leftGutterPreferred
protected int topGutterPreferred
protected int rightGutterPreferred
protected int bottomGutterPreferred
protected boolean clipAtGutter
protected boolean adjustableGutter
protected int width
protected int height
protected java.awt.Color bgColor
protected boolean antialiasTextOn
protected boolean antialiasShapeOn
protected boolean squareAspect
protected boolean autoscaleX
protected boolean autoscaleY
protected double autoscaleMargin
protected double xminPreferred
protected double xmaxPreferred
protected double yminPreferred
protected double ymaxPreferred
protected double xfloor
protected double xceil
protected double yfloor
protected double yceil
protected double xmin
protected double xmax
protected double ymin
protected double ymax
protected boolean fixedPixelPerUnit
protected double xPixPerUnit
protected double yPixPerUnit
protected java.awt.geom.AffineTransform pixelTransform
protected double[] pixelMatrix
protected java.util.ArrayList drawableList
protected boolean validImage
protected java.awt.image.BufferedImage offscreenImage
protected java.awt.image.BufferedImage workingImage
protected TextPanel trMessageBox
protected TextPanel tlMessageBox
protected TextPanel brMessageBox
protected TextPanel blMessageBox
protected java.text.DecimalFormat scientificFormat
protected java.text.DecimalFormat decimalFormat
protected MouseController mouseController
protected boolean showCoordinates
protected org.opensourcephysics.display.DrawingPanel.OptionController optionController
protected DrawingPanel.ZoomBox zoomBox
protected boolean enableZoom
protected boolean zoomMode
protected java.awt.Window customInspector
protected Dimensioned dimensionSetter
protected java.awt.Rectangle viewRect
protected CoordinateStringBuilder coordinateStrBuilder
protected org.opensourcephysics.display.DrawingPanel.GlassPanel glassPanel
protected OSPLayout glassPanelLayout
protected double xMarginPercentage
protected double yMarginPercentage
protected void refreshGUI()
protected void setFontLevel(int level)
level
- the levelprotected void buildPopupmenu()
public void setAutoscaleMargin(double _autoscaleMargin)
_autoscaleMargin
- public void setXMarginPercentage(double _percentage)
_percentage
- public void setYMarginPercentage(double _percentage)
_percentage
- public void setClipAtGutter(boolean clip)
clip
- true<\code> to clip; false<\code> otherwise
public boolean isClipAtGutter()
true<\code> if drawing is clipped at the gutter; false<\code> otherwise
public void setAdjustableGutter(boolean adjustable)
fixed
- true<\code> if gutters remain constant
public boolean isAdjustableGutter()
true<\code> if gutters are adjustable
public void setMouseCursor(java.awt.Cursor cursor)
cursor
- protected boolean checkWorkingImage()
true <\code> if the offscreen image matches the panel; false <\code> otherwise
public void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed
in interface java.awt.event.ActionListener
evt
- public boolean isIconified()
public java.awt.image.BufferedImage render()
render
in interface Renderable
public java.awt.image.BufferedImage render(java.awt.image.BufferedImage image)
render
in interface Renderable
image
- public int getWidth()
getWidth
in class javax.swing.JComponent
public int getHeight()
getHeight
in class javax.swing.JComponent
public double getImageRatio()
public void invalidateImage()
public void paint(java.awt.Graphics g)
paint
in class javax.swing.JComponent
public void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
g
- protected java.awt.Rectangle getViewRect()
protected java.awt.Rectangle findViewRect()
protected void computeGutters()
protected void paintFirst(java.awt.Graphics g)
g
- Graphicsprotected void paintLast(java.awt.Graphics g)
g
- Graphicsprotected void paintEverything(java.awt.Graphics g)
g
- public void setAutoscaleX(boolean autoscale)
autoscale
- public boolean isAutoscaleX()
true<\code> if autoscaled.
public void setAutoscaleY(boolean autoscale)
autoscale
- public boolean isAutoscaleY()
true<\code> if autoscaled.
public void setBounds(int x, int y, int width, int height)
x
and y
, and the
new size is specified by width
and height
.setBounds
in class java.awt.Component
x
- The new x-coordinate of this component.y
- The new y-coordinate of this component.width
- The new width
of this component.height
- The new height
of this
component.public void setBounds(java.awt.Rectangle r)
setBounds
in class java.awt.Component
public void setBuffered(boolean _buffered)
_buffered
- public boolean isBuffered()
public void setVisible(boolean isVisible)
JComponent.setVisible
.setVisible
in class javax.swing.JComponent
isVisible
- true to make the component visible; false to
make it invisiblepublic void limitAutoscaleX(double floor, double ceil)
Double.NaN<\code> will disable that limit.
floor
- the xfloor valueceil
- the xceil valuepublic void limitAutoscaleY(double floor, double ceil)
Double.NaN<\code> will disable that limit.
floor
- the yfloor valueceil
- the yceil valuepublic void setPixelsPerUnit(boolean enable, double xPixPerUnit, double yPixPerUnit)
enable
- boolean enable fixed pixels per unitxPixPerUnit
- doubleyPixPerUnit
- doublepublic void setPreferredMinMax(double xmin, double xmax, double ymin, double ymax)
xmin
- xmax
- ymin
- ymax
- public void setPreferredMinMaxX(double xmin, double xmax)
xmin
- the minimum valuexmax
- the maximum valuepublic void setPreferredMinMaxY(double ymin, double ymax)
ymin
- ymax
- public void setSquareAspect(boolean val)
true<\code>.
val
- public boolean isSquareAspect()
true<\code> if squareAspect
public void setAntialiasTextOn(boolean on)
public boolean isAntialiasTextOn()
public void setAntialiasShapeOn(boolean on)
public boolean isAntialiasShapeOn()
public boolean isPointInside(double x, double y)
x
- the coordinate in world unitsy
- the coordinate in world unitstrue<\code> if point is inside; false<\code> otherwise
public boolean isZoom()
true<\code> if zoom is enabled
public void setZoom(boolean _enableZoom)
_enableZoom
- true<\code> if zoom is enabled; false<\code> otherwise
protected void zoomOut()
public DrawingPanel.ZoomBox getZoomBox()
protected void zoomIn()
public void snapshot()
public boolean hasInspector()
true<\code> if inspector is enabled
public void enableInspector(boolean isEnabled)
isEnabled
- true<\code> if the inspector option is enabled; false<\code> otherwise
public javax.swing.JPopupMenu getPopupMenu()
public void setPopupMenu(javax.swing.JPopupMenu menu)
public void showInspector()
public void hideInspector()
public void setCustomInspector(java.awt.Window w)
w
- the new inspector windowpublic void setVideoTool(VideoTool videoCap)
videoCap
- the video capture toolpublic VideoTool getVideoTool()
public double getAspectRatio()
public double getXPixPerUnit()
public double getYPixPerUnit()
public double getMaxPixPerUnit()
public double getXMin()
public double getPreferredXMin()
public double getXMax()
public double getPreferredXMax()
public double getYMax()
public double getPreferredYMax()
public double getYMin()
public double getPreferredYMin()
public CoordinateStringBuilder getCoordinateStringBuilder()
public void setCoordinateStringBuilder(CoordinateStringBuilder builder)
public java.awt.geom.Rectangle2D getScale()
public java.awt.geom.Rectangle2D getMeasure()
public java.awt.geom.AffineTransform getPixelTransform()
public double[] getPixelMatrix()
public void setPixelScale()
public void recomputeTransform()
public double[] project(double[] coordinate, double[] pixel)
coordinate
- pixel
- public double pixToX(int pix)
pix
- public int xToPix(double x)
x
- public double pixToY(int pix)
pix
- public int yToPix(double y)
y
- public void scale()
protected void scale(java.util.ArrayList tempList)
public void measure()
protected void scaleX()
protected void scaleY()
protected void paintDrawableList(java.awt.Graphics g, java.util.ArrayList tempList)
g
- public javax.swing.JPanel getGlassPanel()
public void setIgnoreRepaint(boolean ignoreRepaint)
setIgnoreRepaint
in class java.awt.Component
public Dimensioned getDimensionSetter()
public void addDrawable(Drawable drawable)
drawable
- public void addDrawables(java.util.Collection drawables)
drawables
- public void replaceDrawable(Drawable oldDrawable, Drawable newDrawable)
oldDrawable
- DrawablenewDrawable
- Drawablepublic void removeDrawable(Drawable drawable)
drawable
- public void removeObjectsOfClass(java.lang.Class c)
c
- the classremoveDrawables(Class c)
public void removeDrawables(java.lang.Class c)
c
- the classremoveObjectsOfClass(Class c)
public void removeOptionController()
public void clear()
public java.util.ArrayList getDrawables()
public java.util.ArrayList getDrawables(java.lang.Class c)
c
- the type of Drawable objectgetObjectOfClass(Class c)
public java.util.ArrayList getObjectOfClass(java.lang.Class c)
c
- the class of the objectgetDrawables(Class c)
public int[] getGutters()
public void setGutters(int[] gutters)
gutters
- int[]public void setGutters(int left, int top, int right, int bottom)
left
- top
- right
- bottom
- public void setPreferredGutters(int left, int top, int right, int bottom)
left
- top
- right
- bottom
- public void resetGutters()
public int getBottomGutter()
public int getTopGutter()
public int getLeftGutter()
public int getRightGutter()
public void setMessage(java.lang.String msg)
msg
- public void setMessage(java.lang.String msg, int location)
msg
- location
- public void setShowCoordinates(boolean show)
show
- public static XML.ObjectLoader getLoader()