我有一個桌面LibGDX項目和我的主要(DesktopLauncher)類擴展JFrame(它將是undecorated和不可調整大小)。我將作爲組件添加到容器中的LwjglCanvas中的LibGDX OpenGL畫布渲染出來。現在,這是一個奇怪的問題:有時我可以在畫布周圍看到3-4-5px的邊框,可以進行一些可疑的調整大小。LwjglCanvas與JFrame調整大小
這裏是我的類:
public DesktopLauncher() {
this.setUndecorated(true);
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.setTitle("Evil Engine (v. Lambda)");
Container container = this.getContentPane();
this.canvas = new LwjglCanvas(new Main(DesktopLauncher.inst));
// this.canvas.getCanvas().setLocation(200, -200);
// height of the task bar
int taskBarSize = Toolkit.getDefaultToolkit().getScreenInsets(this.getGraphicsConfiguration()).bottom;
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.canvas.getCanvas().setSize(screenSize.width, screenSize.height - taskBarSize);
container.add(this.canvas.getCanvas(), BorderLayout.CENTER);
this.pack();
this.setVisible(true);
}
問題可以當setUndecorated是真實可見。我試圖移動畫布(定義的setLocation()線),我看到它周圍有一個邊界:
我已經嘗試了很多事情,但毫無效果:
- 我改變了佈局類型
- 我創建了一個新JPanel,增加畫布到它,並設置爲setContentPane()
- 試圖setPreferedSize,setMaximumSize,了setMinimumSize
- 搜索... setBorder()或..setResizable()方法,但沒有成功
我怎樣才能擺脫在畫布周圍這種可怕的邊界?
去除JFrame的延伸,只是把這個代碼發佈System.setProperty(「org.lwjgl前.opengl.Window.undecorated「,」true「); – Hllink