org.opensourcephysics.display3d.simple3d
Class DrawingFrame3D

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by org.opensourcephysics.display.OSPFrame
                          extended by org.opensourcephysics.display3d.simple3d.DrawingFrame3D
All Implemented Interfaces:
java.awt.datatransfer.ClipboardOwner, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, AppFrame, Hidable, DrawingFrame3D
Direct Known Subclasses:
Display3DFrame

public class DrawingFrame3D
extends OSPFrame
implements java.awt.datatransfer.ClipboardOwner, DrawingFrame3D

DrawingFrame: a frame that contains a generic drawing panel.

Version:
March 2005
Author:
Francisco Esquembre, Adapted from Wolfgang Christian
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Nested classes/interfaces inherited from interface org.opensourcephysics.display3d.core.DrawingFrame3D
DrawingFrame3D.Loader
 
Field Summary
protected  javax.swing.JFrame cameraInspectorFrame
           
protected  javax.swing.JMenuItem cameraItem
           
protected  javax.swing.JMenuItem copyItem
           
protected  javax.swing.JMenuItem cursorCrosshairItem
           
protected  javax.swing.JMenuItem cursorCubeItem
           
protected  javax.swing.JMenu cursorMenu
           
protected  javax.swing.JMenuItem cursorNoneItem
           
protected  javax.swing.JMenuItem cursorXYZItem
           
protected  javax.swing.JMenuItem decorationAxesItem
           
protected  javax.swing.JMenuItem decorationCubeItem
           
protected  javax.swing.JMenu decorationMenu
           
protected  javax.swing.JMenuItem decorationNoneItem
           
protected  javax.swing.JMenu displayMenu
           
protected  javax.swing.JMenuItem displayNoPerspectiveItem
           
protected  javax.swing.JMenuItem displayPerspectiveItem
           
protected  javax.swing.JMenuItem displayXYItem
           
protected  javax.swing.JMenuItem displayXZItem
           
protected  javax.swing.JMenuItem displayYZItem
           
protected  DrawingPanel3D drawingPanel
           
protected  javax.swing.JMenu editMenu
           
protected  javax.swing.JMenu fileMenu
           
protected  javax.swing.JFrame lightInspectorFrame
           
protected  javax.swing.JMenuItem lightItem
           
protected static int MENU_SHORTCUT_KEY_MASK
           
protected  javax.swing.JMenuBar menuBar
           
protected  javax.swing.JMenuItem pasteItem
           
protected  javax.swing.JMenuItem replaceItem
           
protected  javax.swing.JMenuItem resetCameraItem
           
protected  javax.swing.JMenu visualMenu
           
protected  javax.swing.JMenuItem zoomToFitItem
           
 
Fields inherited from class org.opensourcephysics.display.OSPFrame
animated, autoclear, buttonPanel, childFrames, constructorThreadGroup, customButtons, keepHidden, strategy
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DrawingFrame3D()
          Default DrawingFrame constructor
DrawingFrame3D(DrawingPanel3D drawingPanel)
          DrawingFrame constructor specifying the DrawingPanel that will be placed in the center of the content pane.
DrawingFrame3D(java.lang.String title, DrawingPanel3D _drawingPanel)
          DrawingFrame constructor specifying the title and the DrawingPanel that will be placed in the center of the content pane.
 
Method Summary
protected  void copyAction()
          Copies objects found in the specified xml control.
protected  javax.swing.JFrame createLightInspectorFrame(DrawingPanel3D drawingPanel)
          Dummy creator of a LightInspector.
 DrawingPanel3D getDrawingPanel3D()
          Gets the drawing panel.
 javax.swing.JFrame getJFrame()
          Getting the pointer to the real JFrame in it
static XML.ObjectLoader getLoader()
           
 javax.swing.JMenu getMenuItem(java.lang.String menuName)
          Gets a menu with the given name from the menu bar.
 void inspectXML()
          Inspects the drawing frame by using an xml document tree.
protected  javax.swing.JMenu loadToolsMenu()
          Adds a Tools menu to the menu bar.
 void lostOwnership(java.awt.datatransfer.Clipboard clipboard, java.awt.datatransfer.Transferable contents)
          Implementation of ClipboardOwner interface.
protected  void pasteAction()
          Paste action
 javax.swing.JMenu removeMenuItem(java.lang.String menuName)
          Removes a menu with the given name from the menu bar and returns the removed item.
 void render()
          Renders the drawing panel if the frame is showing and not iconified.
 void replaceAction()
          Replaces the drawables with the drawables found in the specified XML control.
 void saveXML()
           
 void setDrawingPanel3D(DrawingPanel3D _drawingPanel)
          Adds the drawing panel to the the frame.
 void setEnabledCopy(boolean enable)
          Enables the copy edit menu item.
 void setEnabledPaste(boolean enable)
          Enables the paste edit menu item.
 void setEnabledReplace(boolean enable)
          Enables the replace edit menu item.
 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.
protected  boolean supportsLightInspectors()
          Whether this implementation supports LightInspectors
 
Methods inherited from class org.opensourcephysics.display.OSPFrame
addButton, addChildFrame, bufferStrategyShow, clearChildFrames, clearData, clearDataAndRepaint, createBufferStrategy, dispose, getChildFrames, getChooser, getConstructorThreadGroup, getMenu, invalidateImage, isAnimated, isAutoclear, isIconified, isKeepHidden, loadDisplayMenu, parseXMLMenu, parseXMLMenu, refreshGUI, removeMenu, removeMenuItem, setAnimated, setAutoclear, setDefaultCloseOperation, setFontLevel, setKeepHidden, setSize, setTitle, setVisible, show, wishesToExit
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opensourcephysics.display3d.core.DrawingFrame3D
setVisible
 
Methods inherited from interface org.opensourcephysics.display.AppFrame
getDefaultCloseOperation
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

fileMenu

protected javax.swing.JMenu fileMenu

editMenu

protected javax.swing.JMenu editMenu

copyItem

protected javax.swing.JMenuItem copyItem

pasteItem

protected javax.swing.JMenuItem pasteItem

replaceItem

protected javax.swing.JMenuItem replaceItem

visualMenu

protected javax.swing.JMenu visualMenu

displayMenu

protected javax.swing.JMenu displayMenu

decorationMenu

protected javax.swing.JMenu decorationMenu

cursorMenu

protected javax.swing.JMenu cursorMenu

displayPerspectiveItem

protected javax.swing.JMenuItem displayPerspectiveItem

displayNoPerspectiveItem

protected javax.swing.JMenuItem displayNoPerspectiveItem

displayXYItem

protected javax.swing.JMenuItem displayXYItem

displayXZItem

protected javax.swing.JMenuItem displayXZItem

displayYZItem

protected javax.swing.JMenuItem displayYZItem

decorationCubeItem

protected javax.swing.JMenuItem decorationCubeItem

decorationNoneItem

protected javax.swing.JMenuItem decorationNoneItem

decorationAxesItem

protected javax.swing.JMenuItem decorationAxesItem

cursorNoneItem

protected javax.swing.JMenuItem cursorNoneItem

cursorCubeItem

protected javax.swing.JMenuItem cursorCubeItem

cursorXYZItem

protected javax.swing.JMenuItem cursorXYZItem

cursorCrosshairItem

protected javax.swing.JMenuItem cursorCrosshairItem

zoomToFitItem

protected javax.swing.JMenuItem zoomToFitItem

resetCameraItem

protected javax.swing.JMenuItem resetCameraItem

cameraItem

protected javax.swing.JMenuItem cameraItem

lightItem

protected javax.swing.JMenuItem lightItem

cameraInspectorFrame

protected javax.swing.JFrame cameraInspectorFrame

lightInspectorFrame

protected javax.swing.JFrame lightInspectorFrame

menuBar

protected javax.swing.JMenuBar menuBar

drawingPanel

protected DrawingPanel3D drawingPanel

MENU_SHORTCUT_KEY_MASK

protected static final int MENU_SHORTCUT_KEY_MASK
Constructor Detail

DrawingFrame3D

public DrawingFrame3D()
Default DrawingFrame constructor


DrawingFrame3D

public DrawingFrame3D(DrawingPanel3D drawingPanel)
DrawingFrame constructor specifying the DrawingPanel that will be placed in the center of the content pane.

Parameters:
drawingPanel -

DrawingFrame3D

public DrawingFrame3D(java.lang.String title,
                      DrawingPanel3D _drawingPanel)
DrawingFrame constructor specifying the title and the DrawingPanel that will be placed in the center of the content pane.

Parameters:
title -
_drawingPanel -
Method Detail

render

public void render()
Renders the drawing panel if the frame is showing and not iconified.

Overrides:
render in class OSPFrame

setMessage

public void setMessage(java.lang.String msg)
Shows a message in a yellow text box in the lower right hand corner.

Parameters:
msg -

setMessage

public void setMessage(java.lang.String msg,
                       int location)
Shows a message in a yellow text box. location 0=bottom left location 1=bottom right location 2=top right location 3=top left

Parameters:
msg -
location -

getDrawingPanel3D

public DrawingPanel3D getDrawingPanel3D()
Gets the drawing panel.

Specified by:
getDrawingPanel3D in interface DrawingFrame3D
Returns:
the drawingPanel

setDrawingPanel3D

public void setDrawingPanel3D(DrawingPanel3D _drawingPanel)
Adds the drawing panel to the the frame. The panel is added to the center of the frame's content pane.

Specified by:
setDrawingPanel3D in interface DrawingFrame3D
Parameters:
_drawingPanel -

getJFrame

public javax.swing.JFrame getJFrame()
Getting the pointer to the real JFrame in it

Specified by:
getJFrame in interface DrawingFrame3D
Returns:
JFrame

setEnabledPaste

public void setEnabledPaste(boolean enable)
Enables the paste edit menu item.

Parameters:
enable - boolean

pasteAction

protected void pasteAction()
Paste action


setEnabledReplace

public void setEnabledReplace(boolean enable)
Enables the replace edit menu item.

Parameters:
enable - boolean

replaceAction

public void replaceAction()
Replaces the drawables with the drawables found in the specified XML control.


copyAction

protected void copyAction()
Copies objects found in the specified xml control.


lostOwnership

public void lostOwnership(java.awt.datatransfer.Clipboard clipboard,
                          java.awt.datatransfer.Transferable contents)
Implementation of ClipboardOwner interface. Override this method to receive notification that data copied to the clipboard has changed.

Specified by:
lostOwnership in interface java.awt.datatransfer.ClipboardOwner
Parameters:
clipboard - Clipboard
contents - Transferable

setEnabledCopy

public void setEnabledCopy(boolean enable)
Enables the copy edit menu item.

Parameters:
enable - boolean

supportsLightInspectors

protected boolean supportsLightInspectors()
Whether this implementation supports LightInspectors

Returns:

createLightInspectorFrame

protected javax.swing.JFrame createLightInspectorFrame(DrawingPanel3D drawingPanel)
Dummy creator of a LightInspector. To be overwritten by packages that offer light inspectors

Parameters:
drawingPanel -
Returns:

loadToolsMenu

protected javax.swing.JMenu loadToolsMenu()
Adds a Tools menu to the menu bar.

Overrides:
loadToolsMenu in class OSPFrame

getMenuItem

public javax.swing.JMenu getMenuItem(java.lang.String menuName)
Gets a menu with the given name from the menu bar. Returns null if menu item does not exist.

Parameters:
menuName - String
Returns:
JMenu

removeMenuItem

public javax.swing.JMenu removeMenuItem(java.lang.String menuName)
Removes a menu with the given name from the menu bar and returns the removed item. Returns null if menu item does not exist.

Parameters:
menuName - String
Returns:
JMenu

inspectXML

public void inspectXML()
Inspects the drawing frame by using an xml document tree.


saveXML

public void saveXML()

getLoader

public static XML.ObjectLoader getLoader()