LWJGL显示和Java Swing [英] LWJGL display and java swing
问题描述
我创建了一个带有JSplitPane的JFrame,它的左侧包含一个画布,右侧包含一个JPanel. 画布包含LWJGL显示,JPanel中包含几个JTextField.问题是,当我在LWJGL显示器上按下鼠标按钮时,无法再将文本写入JTextFields.当我最小化该应用程序并将其返回时,它会一直起作用,直到再次按下显示屏.
I have created a JFrame with a JSplitPane in it, which contains a canvas in the left and a JPanel in the right. The canvas contains LWJGL display, and the JPanel has few JTextFields in it. The problem is that when I press a mouse button on the LWJGL display, I can't write text into JTextFields anymore. When I minimize the application and return it back, it works until I press on the display again.
为什么会出现此问题?我该如何解决?
注意:我可以专注于文本字段,但是我什么都不能写.也许LWJGL以某种方式阻止了Swings键盘输入?
推荐答案
通过将java.awt.Canvas
添加到javax.swing.JSplitPane
,您就是此处中提到的方法之一.
By adding a java.awt.Canvas
to a javax.swing.JSplitPane
, you're Mixing Heavyweight and Lightweight Components. As an alternative, you might try one of the approaches mentioned here.
这篇关于LWJGL显示和Java Swing的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!