|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--org.selman.java3d.book.swingtest.SwingTest
This example displays a Swing based application with a JMenuBar that allows you to switch between displaying a Cube and a Sphere. You can also perform a simple screen capture and start/stop rotation using menu commands.
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 |
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.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 | |
SwingTest()
Constructor. |
Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent ae)
AWT callback to indicate that an items has been selected from a menu. |
protected void |
addCanvas3D(javax.media.j3d.Canvas3D c3d)
Callback to allow the Canvas3D to be added to a Panel. |
protected void |
addViewBranchGroup(javax.media.j3d.Locale locale,
javax.media.j3d.BranchGroup bg)
Adds the View side of the scenegraph to the Locale |
protected javax.media.j3d.Bounds |
createApplicationBounds()
Create a Bounds object for the scene. |
protected javax.media.j3d.Background |
createBackground()
Create a Background for the Canvas3D. |
protected javax.media.j3d.Canvas3D |
createCanvas3D(boolean offscreen)
Create a Canvas3D. |
protected javax.media.j3d.BranchGroup |
createCube()
Create a BranchGroup that contains a Cube. |
protected javax.media.j3d.Locale |
createLocale(javax.media.j3d.VirtualUniverse u)
Create a Locale for the VirtualUniverse |
javax.swing.JMenuBar |
createMenuBar()
|
protected javax.media.j3d.Canvas3D |
createOffscreenCanvas3D()
Initialize an offscreen Canvas3D. |
protected javax.media.j3d.PhysicalBody |
createPhysicalBody()
Creates the PhysicalBody for the View |
protected javax.media.j3d.PhysicalEnvironment |
createPhysicalEnvironment()
Creates the PhysicalEnvironment for the View |
protected javax.media.j3d.BranchGroup |
createSceneBranchGroup()
Create the scene side of the scenegraph |
protected javax.media.j3d.BranchGroup |
createSphere()
Create a BranchGroup that contains a Sphere. |
protected javax.media.j3d.View |
createView(javax.media.j3d.ViewPlatform vp)
Create a Java 3D View and attach it to a ViewPlatform |
protected javax.media.j3d.BranchGroup |
createViewBranchGroup(javax.media.j3d.TransformGroup[] tgArray,
javax.media.j3d.ViewPlatform vp)
Creates the View side BranchGroup. |
protected javax.media.j3d.ViewPlatform |
createViewPlatform()
Creates the View Platform for the View |
protected javax.media.j3d.VirtualUniverse |
createVirtualUniverse()
Creates the VirtualUniverse for the application. |
protected double |
getBackClipDistance()
Returns the distance to the rear clipping plane. |
protected double |
getFrontClipDistance()
Returns the distance to the near clipping plane. |
protected double |
getScale()
Callback to get the scale factor for the View side of the scenegraph |
protected float |
getViewPlatformActivationRadius()
Returns the View Platform Activation Radius |
javax.media.j3d.TransformGroup[] |
getViewTransformGroupArray()
Get the TransformGroup for the View side of the scenegraph |
protected void |
init()
Initialize the Java 3D rendering system and view side scenegraph. |
static void |
main(java.lang.String[] args)
main entry point for the application. |
protected void |
onSaveImage()
Called to render the scene into the offscreen Canvas3D and save the image (as a JPEG) to disk. |
protected static void |
registerWindowListener(javax.swing.JFrame frame)
|
protected void |
removeShape(java.lang.String name)
Removes a BranchGroup from the scene based on user data |
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, paintComponent, 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 |
Constructor Detail |
public SwingTest()
Method Detail |
protected void init()
protected void addCanvas3D(javax.media.j3d.Canvas3D c3d)
protected javax.media.j3d.View createView(javax.media.j3d.ViewPlatform vp)
protected javax.media.j3d.Background createBackground()
protected javax.media.j3d.Bounds createApplicationBounds()
protected javax.media.j3d.Canvas3D createCanvas3D(boolean offscreen)
offscreen
- true to specify an offscreen canvasprotected javax.media.j3d.Canvas3D createOffscreenCanvas3D()
protected double getScale()
public javax.media.j3d.TransformGroup[] getViewTransformGroupArray()
protected void addViewBranchGroup(javax.media.j3d.Locale locale, javax.media.j3d.BranchGroup bg)
protected javax.media.j3d.Locale createLocale(javax.media.j3d.VirtualUniverse u)
protected javax.media.j3d.BranchGroup createSceneBranchGroup()
protected javax.media.j3d.BranchGroup createCube()
protected javax.media.j3d.BranchGroup createSphere()
protected void removeShape(java.lang.String name)
name
- the user data to look forprotected javax.media.j3d.PhysicalBody createPhysicalBody()
protected javax.media.j3d.PhysicalEnvironment createPhysicalEnvironment()
protected float getViewPlatformActivationRadius()
protected javax.media.j3d.ViewPlatform createViewPlatform()
protected double getBackClipDistance()
protected double getFrontClipDistance()
protected javax.media.j3d.BranchGroup createViewBranchGroup(javax.media.j3d.TransformGroup[] tgArray, javax.media.j3d.ViewPlatform vp)
protected javax.media.j3d.VirtualUniverse createVirtualUniverse()
protected void onSaveImage()
public void actionPerformed(java.awt.event.ActionEvent ae)
actionPerformed
in interface java.awt.event.ActionListener
protected static void registerWindowListener(javax.swing.JFrame frame)
public javax.swing.JMenuBar createMenuBar()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |