Java Doc for JCanvas3D.java in  » 6.0-JDK-Modules » java-3d » com » sun » j3d » exp » swing » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » java 3d » com.sun.j3d.exp.swing 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.swing.JPanel
   com.sun.j3d.exp.swing.JCanvas3D

JCanvas3D
public class JCanvas3D extends JPanel implements AncestorListener(Code)
This class provides a lightweight capability to Java 3D. The component handles bidirectional messaging between swing and Java 3D so that repaint ordonned by swing are sent to the universe if necessary and refreshes from the universe are painted accordingly. In order to get responsive interfaces during layout changes, the canvas has a feature (disabled by default) that lets true resizes occur only after a timer expires. Images between real resizes can eventually be slightly wrong and pixelated, but their display will be stutterless.
Lightweight canvas also handles redirection to heavyweight canvas for the following events:
- InputMethodEvent
- KeyEvent
- FocusEvent
- ComponentKeyEvent
- MouseWheelEvent
- MouseEvent
- MouseMotionEvent


When Swing is waiting for a canvas to be retrieved and that canvas is in rendering stage,a loop takes place, which includes small calls to wait(). The canvas status is tested for readiness before and after the wait(). If the canvas is not ready to be retrieved after the wait(), counter is decremented and control is given back to awt thread, which will repaint old buffer. If the loop goes over a certain amount of iterations, the canvas is declared 'crashed' and won't be updated anymore. This was done so that a crashed canvas/universe does not remove control over your GUI and does not leave you with a frozen application. In current implementation, the delay before a canvas is declared crashed is of :
30 Math.max(20.0, getView().getMinimumFrameCycleTime() )
author:
   Frederic 'pepe' Barachant
See Also:    getLightweightComponent()
See Also:    setResizeValidationDelay()
See Also:    setResizeMode()
since:
   Java 3D 1.5

Inner Class :static class InternalCanvas3D extends Canvas3D implements AutoOffScreenCanvas3D
Inner Class :static class ResizeSwingRunnable implements Runnable
Inner Class :static class ResizeThread extends Thread

Field Summary
final public static  intRESIZE_DELAYED
     Resizing the canvas or component will be done if no resizing occurs after expiration of a certain delay.
final public static  intRESIZE_IMMEDIATELY
     Resizing the canvas or component will be done immediately.
 intresizeMode
     The resize mode currently being used.
 intresizeValidationDelay
     the idle delay that will trigger a real resize.

Constructor Summary
public  JCanvas3D()
     Constructs and initializes a new JCanvas3D object that Java 3D can render into.
public  JCanvas3D(GraphicsDevice device)
     Constructs and initializes a new Canvas3D object that Java 3D can render into, using the specified graphics device.
public  JCanvas3D(GraphicsConfigTemplate3D template)
     Constructs and initializes a new Canvas3D object that Java 3D can render into, using the specified template. The screen device is obtained from GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(), which might not be the one you should use if you are in a multiscreen environment.
Parameters:
  template - The template that will be used to construct aGraphicsConfiguration.
public  JCanvas3D(GraphicsConfigTemplate3D template, GraphicsDevice device)
     Constructs and initializes a new Canvas3D object that Java 3D can render into, using the specified template and graphics device.
Parameters:
  template - The template that will be used to construct aGraphicsConfiguration.

Method Summary
public  voidancestorAdded(javax.swing.event.AncestorEvent event)
    
public  voidancestorMoved(javax.swing.event.AncestorEvent event)
    
public  voidancestorRemoved(javax.swing.event.AncestorEvent event)
    
 voidcreateCanvas(int width, int height)
     Creates a heavyweight canvas and initializes it, or changes the size of the current one if present.
public  Canvas3DgetOffscreenCanvas3D()
     Returns the offscreen heavyweight canvas of that lightweight component.
public  intgetResizeMode()
     Retrieves the resize mode for that component.
public  intgetResizeValidationDelay()
     Retrieves the validation delay for that canvas, whatever the resize mode is set to.
public  voidpaintComponent(java.awt.Graphics g)
     Paints the result of the rendering.
protected  voidprocessComponentKeyEvent(java.awt.event.KeyEvent e)
     Redirects event to canvas and to superclass.
protected  voidprocessFocusEvent(java.awt.event.FocusEvent e)
     Redirects event to canvas and to superclass.
protected  voidprocessInputMethodEvent(java.awt.event.InputMethodEvent e)
     Redirects event to canvas and to superclass.
protected  voidprocessKeyEvent(java.awt.event.KeyEvent e)
     Redirects event to canvas and to superclass.
protected  voidprocessMouseEvent(java.awt.event.MouseEvent e)
     Redirects event to canvas and to superclass.
protected  voidprocessMouseMotionEvent(java.awt.event.MouseEvent e)
     Redirects event to canvas and to superclass.
protected  voidprocessMouseWheelEvent(java.awt.event.MouseWheelEvent e)
     Redirects event to canvas and to superclass.
public  voidsetBounds(int x, int y, int width, int height)
    
public  voidsetResizeMode(int resizeMode)
     Sets resize mode to be used on this component.
public  voidsetResizeValidationDelay(int resizeValidationDelay)
     Sets the validation delay for the component.

Field Detail
RESIZE_DELAYED
final public static int RESIZE_DELAYED(Code)
Resizing the canvas or component will be done if no resizing occurs after expiration of a certain delay. Rendering will be eventually stretched or deformed. It can be useful on certain applications where smooth update of UI during layout is needed or desired.
See Also:    setResizeMode()



RESIZE_IMMEDIATELY
final public static int RESIZE_IMMEDIATELY(Code)
Resizing the canvas or component will be done immediately. This operation might take some time and make the application look sluggish.
See Also:    setResizeMode()



resizeMode
int resizeMode(Code)
The resize mode currently being used.



resizeValidationDelay
int resizeValidationDelay(Code)
the idle delay that will trigger a real resize. ('idle' being the lack of resizing action from the user)




Constructor Detail
JCanvas3D
public JCanvas3D()(Code)
Constructs and initializes a new JCanvas3D object that Java 3D can render into. The screen device is obtained from GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(), which might not be the one you should use if you are in a multiscreen environment. The JCanvas3D is constructed using the following default parameters:
resize mode : RESIZE_IMMEDIATELY
validation delay : 100ms
double buffer enable : false
stereo enable : false



JCanvas3D
public JCanvas3D(GraphicsDevice device)(Code)
Constructs and initializes a new Canvas3D object that Java 3D can render into, using the specified graphics device.
Parameters:
  device - the screen graphics device that will be used to constructa GraphicsConfiguration.



JCanvas3D
public JCanvas3D(GraphicsConfigTemplate3D template)(Code)
Constructs and initializes a new Canvas3D object that Java 3D can render into, using the specified template. The screen device is obtained from GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(), which might not be the one you should use if you are in a multiscreen environment.
Parameters:
  template - The template that will be used to construct aGraphicsConfiguration. The stereo and doublebuffer propertiesare forced to UNNECESSARY.



JCanvas3D
public JCanvas3D(GraphicsConfigTemplate3D template, GraphicsDevice device)(Code)
Constructs and initializes a new Canvas3D object that Java 3D can render into, using the specified template and graphics device.
Parameters:
  template - The template that will be used to construct aGraphicsConfiguration. The stereo and doublebuffer propertiesare forced to UNNECESSARY.
Parameters:
  device - the screen graphics device that will be used to constructa GraphicsConfiguration in conjunction with the template.




Method Detail
ancestorAdded
public void ancestorAdded(javax.swing.event.AncestorEvent event)(Code)

Parameters:
  event -



ancestorMoved
public void ancestorMoved(javax.swing.event.AncestorEvent event)(Code)

Parameters:
  event -



ancestorRemoved
public void ancestorRemoved(javax.swing.event.AncestorEvent event)(Code)

Parameters:
  event -



createCanvas
void createCanvas(int width, int height)(Code)
Creates a heavyweight canvas and initializes it, or changes the size of the current one if present. Current heavyweight canvas is changed only if size is different from the actual one. No canvas is created if this component has no parent, that is, was not added to a container.
Parameters:
  width - the width of the canvas to create.
Parameters:
  height - the height of the canvas to create.



getOffscreenCanvas3D
public Canvas3D getOffscreenCanvas3D()(Code)
Returns the offscreen heavyweight canvas of that lightweight component. the heavyweight canvas that lies in the deepness of thisComponent.



getResizeMode
public int getResizeMode()(Code)
Retrieves the resize mode for that component. the resize mode, which can be one of RESIZE_IMMEDIATELY orRESIZE_DELAYED



getResizeValidationDelay
public int getResizeValidationDelay()(Code)
Retrieves the validation delay for that canvas, whatever the resize mode is set to. the validation delay.



paintComponent
public void paintComponent(java.awt.Graphics g)(Code)
Paints the result of the rendering. If the rendered buffer is not useable (render thread being between [code]postRender()[/code] and [code]postSwap()[/code]), it will wait for it to be ready. Otherwise it will directly paint the previous buffer.
Parameters:
  g -



processComponentKeyEvent
protected void processComponentKeyEvent(java.awt.event.KeyEvent e)(Code)
Redirects event to canvas and to superclass.
Parameters:
  e -



processFocusEvent
protected void processFocusEvent(java.awt.event.FocusEvent e)(Code)
Redirects event to canvas and to superclass.
Parameters:
  e -



processInputMethodEvent
protected void processInputMethodEvent(java.awt.event.InputMethodEvent e)(Code)
Redirects event to canvas and to superclass.
Parameters:
  e -



processKeyEvent
protected void processKeyEvent(java.awt.event.KeyEvent e)(Code)
Redirects event to canvas and to superclass.
Parameters:
  e -



processMouseEvent
protected void processMouseEvent(java.awt.event.MouseEvent e)(Code)
Redirects event to canvas and to superclass.
Parameters:
  e -



processMouseMotionEvent
protected void processMouseMotionEvent(java.awt.event.MouseEvent e)(Code)
Redirects event to canvas and to superclass.
Parameters:
  e -



processMouseWheelEvent
protected void processMouseWheelEvent(java.awt.event.MouseWheelEvent e)(Code)
Redirects event to canvas and to superclass.
Parameters:
  e -



setBounds
public void setBounds(int x, int y, int width, int height)(Code)

Parameters:
  x -
Parameters:
  y -
Parameters:
  width -
Parameters:
  height -



setResizeMode
public void setResizeMode(int resizeMode)(Code)
Sets resize mode to be used on this component. Resize mode permits to have smoother canvas resizes. The time taken by a canvas to be resized can be pretty long: renderer has to stop, current render has to end, everything has to be initialized again, and after all that has been done, renderer is started again, then the image is displayed once rendered. Resize mode uses a timer to make those steps only after the last refresh request occured. 'Latest refresh' is determined by the amount of time between now and the last time you asked for a size change. If that time expires, a real resize is done. In between, the same size is rendered, but the drawn image is scaled down/up. This has some drawbacks, as the image can appear blocked, imprecise, distorted, incomplete for that while, but most of the time only some of the drawbacks will be users will see nothing. Default delay is set to 100ms, which is low enough for common human not to be able to really see that the rendered image is scaled.
Parameters:
  resizeMode - can be one of RESIZE_IMMEDIATELY or RESIZE_DELAYED
See Also:   JCanvas3D.RESIZE_IMMEDIATELY
See Also:   JCanvas3D.RESIZE_DELAYED



setResizeValidationDelay
public void setResizeValidationDelay(int resizeValidationDelay)(Code)
Sets the validation delay for the component. The validation delay is the maximum time allowed for the canvas resizing to occur using rendered buffer scaling. Once that delay expired, the canvas is resized at the lowest level possible, thus in the rendering pipeline. Note: Changing this field is only useful if resize mode is set to RESIZE_IMMEDIATELY or RESIZE_DELAYED
Parameters:
  resizeValidationDelay - the delay before a real resize would occur.
See Also:   JCanvas3D.RESIZE_IMMEDIATELY
See Also:   JCanvas3D.RESIZE_DELAYED



Methods inherited from javax.swing.JPanel
public AccessibleContext getAccessibleContext()(Code)(Java Doc)
public PanelUI getUI()(Code)(Java Doc)
public String getUIClassID()(Code)(Java Doc)
protected String paramString()(Code)(Java Doc)
public void setUI(PanelUI ui)(Code)(Java Doc)
public void updateUI()(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.