Package org.xj3d.ui.awt.browser.ogl
Class BrowserJPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.xj3d.ui.awt.browser.ogl.BrowserJPanel
- All Implemented Interfaces:
ComponentListener
,KeyListener
,WindowListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,BrowserComponent
,BrowserCoreListener
- Direct Known Subclasses:
VRMLBrowserJPanel
,X3DBrowserJPanel
public abstract class BrowserJPanel
extends JPanel
implements BrowserComponent, BrowserCoreListener, ComponentListener, WindowListener, KeyListener
Common Swing JPanel implementation of the browser component for use in
either SAI or EAI, that wraps the functionality of a VRML browser
into a convenient, easy to use form.
This base class needs to be extended to provide the SAI or EAI-specific implementation interfaces, as well as any startup required for both of those environments, such as scripting engines etc.
- Version:
- $Revision: 1.30 $
- Author:
- Justin Couch, Brad Vender
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SwingConsoleWindow
Area to push error messages toprotected CursorManager
The cursorManagerprotected SwingLocationToolbar
The toolbar holding location informationprotected OGLBrowserCanvas
The canvas used to display the worldprotected SwingNavigationToolbar
The toolbar holding navigation informationprotected SwingStatusBar
The status barprotected org.j3d.aviatrix3d.pipeline.graphics.GraphicsOutputDevice
Our drawing surfaceprotected OGLStandardBrowserCore
The internal universeFields 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
Fields inherited from class java.awt.Component
accessibleContext, 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
ConstructorsModifierConstructorDescriptionprotected
BrowserJPanel
(BrowserConfig parameters) Create an instance of the panel configured to show or hide the controls and only shows VRML97 content. -
Method Summary
Modifier and TypeMethodDescriptionvoid
This panel, or a container in which it 'lives' is being added to a parent.void
The browser has been disposed by the user calling the dispose method on the ExternalBrowser instance.void
browserInitialized
(VRMLScene scene) Ignored.void
Ignored.void
void
void
void
void
destroy()
Called to instruct the component instance to destroy itself and any used resources.Get the core browser implementation.Get the UI toolkit specific component holding this browser.org.j3d.util.ErrorReporter
Fetch the error handler so that application code can post messages too.int
Get the renderer type.void
void
void
void
This panel, or a container in which it 'lives' is being removed from it's parent.void
setMinimumFrameInterval
(int millis, boolean userSet) Set the minimum frame interval time to limit the CPU resources taken up by the 3D renderer.void
start()
Called to instruct the component instance to start rendering now.void
stop()
Called to instruct the component instance to stop and suspend its state.int
Get the spec version that is supported.void
urlLoadFailed
(String msg) Ignored.void
void
windowClosed
(WindowEvent evt) void
windowClosing
(WindowEvent evt) void
void
void
void
windowOpened
(WindowEvent evt) Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, 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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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
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, 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 Details
-
surface
protected org.j3d.aviatrix3d.pipeline.graphics.GraphicsOutputDevice surfaceOur drawing surface -
locToolbar
The toolbar holding location information -
statusBar
The status bar -
console
Area to push error messages to -
mainCanvas
The canvas used to display the world -
cursorManager
The cursorManager -
universe
The internal universe
-
-
Constructor Details
-
BrowserJPanel
Create an instance of the panel configured to show or hide the controls and only shows VRML97 content.- Parameters:
parameters
- The object containing the browser's configuration parameters
-
-
Method Details
-
removeNotify
public void removeNotify()This panel, or a container in which it 'lives' is being removed from it's parent. Inform the canvas to stop rendering before it's removeNotify() method is called, otherwise the ui will lockup.- Overrides:
removeNotify
in classJComponent
-
addNotify
public void addNotify()This panel, or a container in which it 'lives' is being added to a parent. Inform the canvas to start rendering. By default the canvas should be enabled initially. This method is in place to restart rendering in the instance that the component has been removed and is being reinserted into the ui.- Overrides:
addNotify
in classJComponent
-
keyPressed
- Specified by:
keyPressed
in interfaceKeyListener
-
keyReleased
- Specified by:
keyReleased
in interfaceKeyListener
-
keyTyped
- Specified by:
keyTyped
in interfaceKeyListener
-
windowActivated
- Specified by:
windowActivated
in interfaceWindowListener
-
windowClosed
- Specified by:
windowClosed
in interfaceWindowListener
-
windowClosing
- Specified by:
windowClosing
in interfaceWindowListener
-
windowDeactivated
- Specified by:
windowDeactivated
in interfaceWindowListener
-
windowDeiconified
- Specified by:
windowDeiconified
in interfaceWindowListener
-
windowIconified
- Specified by:
windowIconified
in interfaceWindowListener
-
windowOpened
- Specified by:
windowOpened
in interfaceWindowListener
-
componentHidden
- Specified by:
componentHidden
in interfaceComponentListener
-
componentMoved
- Specified by:
componentMoved
in interfaceComponentListener
-
componentResized
- Specified by:
componentResized
in interfaceComponentListener
-
componentShown
- Specified by:
componentShown
in interfaceComponentListener
-
supportedSpecificationVersion
public int supportedSpecificationVersion()Description copied from interface:BrowserComponent
Get the spec version that is supported.- Specified by:
supportedSpecificationVersion
in interfaceBrowserComponent
- Returns:
- a number representing the spec major version
-
getCanvas
Description copied from interface:BrowserComponent
Get the UI toolkit specific component holding this browser.- Specified by:
getCanvas
in interfaceBrowserComponent
- Returns:
- The component
-
getRendererType
public int getRendererType()Description copied from interface:BrowserComponent
Get the renderer type.- Specified by:
getRendererType
in interfaceBrowserComponent
- Returns:
- The BrowserCore type
-
getBrowserCore
Description copied from interface:BrowserComponent
Get the core browser implementation.- Specified by:
getBrowserCore
in interfaceBrowserComponent
- Returns:
- the BrowserCore
-
getErrorReporter
public org.j3d.util.ErrorReporter getErrorReporter()Description copied from interface:BrowserComponent
Fetch the error handler so that application code can post messages too.- Specified by:
getErrorReporter
in interfaceBrowserComponent
- Returns:
- The current error handler instance
-
setMinimumFrameInterval
public void setMinimumFrameInterval(int millis, boolean userSet) Description copied from interface:BrowserComponent
Set the minimum frame interval time to limit the CPU resources taken up by the 3D renderer. By default it will use all of them. The second parameter is used to control whether this is a user-set hard minimum or something set by the browser internals. User set values are always treated as the minimum unless the browser internals set a value that is a slower framerate than the user set. If the browser then sets a faster framerate than the user set value, the user value is used instead.- Specified by:
setMinimumFrameInterval
in interfaceBrowserComponent
- Parameters:
millis
- The minimum time in milliseconds.userSet
- true if this is an end-user set minimum
-
start
public void start()Description copied from interface:BrowserComponent
Called to instruct the component instance to start rendering now.- Specified by:
start
in interfaceBrowserComponent
-
stop
public void stop()Description copied from interface:BrowserComponent
Called to instruct the component instance to stop and suspend its state. The renderer should stop at this point.- Specified by:
stop
in interfaceBrowserComponent
-
destroy
public void destroy()Description copied from interface:BrowserComponent
Called to instruct the component instance to destroy itself and any used resources. It will not be used again.- Specified by:
destroy
in interfaceBrowserComponent
-
browserShutdown
public void browserShutdown()Ignored. Notification that the browser is shutting down the current content.- Specified by:
browserShutdown
in interfaceBrowserCoreListener
-
browserDisposed
public void browserDisposed()The browser has been disposed by the user calling the dispose method on the ExternalBrowser instance. Release our reference to the browser core.- Specified by:
browserDisposed
in interfaceBrowserCoreListener
-
urlLoadFailed
Ignored. The browser tried to load a URL and failed.- Specified by:
urlLoadFailed
in interfaceBrowserCoreListener
- Parameters:
msg
- An error message to go with the failure
-
browserInitialized
Ignored. Notification that a world has been loaded into the browser.- Specified by:
browserInitialized
in interfaceBrowserCoreListener
- Parameters:
scene
- The new scene that has been loaded
-