简体   繁体   English

使用Java 7的Linux上的立体声问题-将组件添加到父组件后如何更改其GC

[英]Stereo problems on Linux using Java 7 - how to change the GC of a component after it has been added to a parent

I have an AWT canvas contained within a JPanel and displayed on screen. 我有一个包含在JPanel中并显示在屏幕上的AWT画布。 I currently use Java 7 update 45 and run on Red Hat 6. 我目前使用Java 7 update 45并在Red Hat 6上运行。

When the user requests an openGL stereo capable canvas, i remove the existing canvas, create a new canvas that chooses a stereo visual and sets the appropriate GraphicsConfiguration on the canvas. 当用户请求具有openGL立体声功能的画布时,我将删除现有的画布,创建一个新的画布,该画布选择一个立体视觉效果并在画布上设置适当的GraphicsConfiguration。 The problem is, with new changes made in Java 7, when this canvas is added back to the JPanel, the GraphicsConfiguration(GC) of the Jpanel overwrites the GraphicsConfiguration of the Canvas. 问题在于,随着Java 7中的新更改,当将此画布重新添加到JPanel时,Jpanel的GraphicsConfiguration(GC)会覆盖Canvas的GraphicsConfiguration。

This happens in java.awt.Container.addImpl() where it calls the package scoped method Component.setGraphicsConfiguration() . 这发生在java.awt.Container.addImpl()中 ,在该处它调用包范围的方法Component.setGraphicsConfiguration()

I am currently using Reflection on this package scoped method to call the method from my code and change the GC on the canvas. 我目前在此包范围方法上使用Reflection,以从我的代码中调用该方法并更改画布上的GC。

Is there any better solution than this ? 有没有比这更好的解决方案了? In other words, how to change the GC of a component after it has been added to a parent ? 换句话说,如何在将组件添加到父组件后更改其GC?

I suggest you do not change the GC at all. 我建议您根本不要更改GC。 Instead just try to create a stereo capable GC and allow fallback to non-stereoscopic GC. 而是尝试创建具有立体声功能的GC,并允许回退到非立体GC。 If that succeeds enable the stereoscopic rendering path and menu entries. 如果成功,则启用立体渲染路径和菜单项。

The Stereoscopic regression caused by the JDK 7 AWT changes is reported in and worked on in the following bugreport: https://bugs.openjdk.java.net/browse/JDK-8036875 - Component.setGraphicsConfiguration() breaks some 3D applications 在以下错误报告中报告了JDK 7 AWT更改引起的立体回归并进行了处理: https ://bugs.openjdk.java.net/browse/JDK-8036875-Component.setGraphicsConfiguration()破坏了某些3D应用程序

A workaround made by "babor" for Java3D Canvas3D users is to override the Canvas3D hierarchyChanged method and update the topmost component using reflection to use the stereoscopic graphics configuration. “ babor”对Java3D Canvas3D用户的解决方法是重写Canvas3DarchitectureChanged方法,并使用反射更新最顶层的组件以使用立体图形配置。 http://forum.jogamp.org/Java3D-stereo-tp4029914p4031792.html http://forum.jogamp.org/Java3D-stereo-tp4029914p4031792.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Java 8的父组件中重新添加组件后,该组件不再收到鼠标事件 - Component does not receive mouse event anymore after it has been re-added in parent component in Java 8 在运行时添加组件后如何使 JScrollPane 可滚动 - How to make a JScrollPane scrollable after a component has been added at runtime 显示JFrame后如何更改它的内容(java) - how to change the contents of a JFrame after it has been displayed (java) 如何确保在循环遍历列表后添加的Java并发列表中的元素得到正确处理? - How to make sure elements of a concurrent list in java, that are added after the list has been looped through, are handled properly? Linux中的Java Swing组件问题 - Java Swing Component Problems in Linux 如何找出 java 中使用的总 memory 字节以及已被 GC 删除的对象? - How to find out the total memory bytes used in java with the objects that has been removed out by GC? 在将特定于孩子的方法作为父类添加到数组后,调用它 - Calling a child-specific method after it has been added to the array as a parent class 如何在多个类实现后正确更改接口? java的 - how to properly change an interface after it has been implemented by many classes? java 达到一定分数后如何更改等级? (Java、NetBeans) - How do I change my level after a certain score has been reached? (Java, NetBeans) 如何使用 springboot 检查用户是否已添加到 LDAP 组 - How to check if the user has been added to LDAP group using springboot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM