JFrame在Awesome WM中的位置和pack() [英] JFrame's position and pack() in Awesome WM

查看:106
本文介绍了JFrame在Awesome WM中的位置和pack()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我在JFrame上调用pack()方法时,它都会移动到启动时的初始位置。当我尝试获取JFrame的位置(getLocation,getLocationOnScreen)时,无论我是否移动窗口,它都与初始位置相同。我正在使用Awesome WM运行Archlinux。请帮忙。

every time when I call pack() method on JFrame, it moves to the initial position where was when started. When I try to get the location of the JFrame (getLocation, getLocationOnScreen) it's still the same as initial position no matter I'm moving the window. I am running Archlinux with Awesome WM. Please help.

感谢Uiii

编辑:我要的是能够在不将窗口移至初始位置的情况下显示或隐藏主窗口中的某些组件(这会导致布局调整大小)。

What I just want is to be able to show or hide some components in the main window (which cause layout resizing) without moving the windows to the initial position.

EDIT2:因此,我刚刚发现Paŭlo(从评论中)是正确的。在Xfce中它可以正常工作,但在Awesome WM中则不能。

So I just found that Paŭlo (from comment) is right. It works fine in Xfce, but in Awesome WM not.

EDIT3 :我真的不明白您为什么反对这个问题。这是我第一次使用pack()函数,因此我不知道它的正确行为是什么。如果窗口的位置会发生变化,java API文档中没有任何解释。我只是在我用作窗口管理器的Awesome WM中使用了它的第一个,所以我不知道它应该以其他方式运行。我试图在互联网上找到有关它的内容,但一无所获。我认为这个问题对我找到解决方案的人很有用。当然,还有其他Java开发人员正在使用Awesome WM(或一些具有相同问题的类似软件)。

I really don't understand why are you voting the question down. It's the first time I'm using pack() function, so I don't know what is its correct behavior. There is no explanation in the java API document if the window's position will change. I just use this the first in Awesome WM which I am using as my window manager, so I don't know that should behave another way. I have tried to find something about it on the internet but found nothing. I think that this question can be useful to someone after I've found the solution. There are certainly another java developers who are using Awesome WM (or some similar with the same problem).

推荐答案

我发现了解!问题是Java在某些窗口管理器中存在一些问题。解决方案很简单-只需安装 wmname 实用程序( http://tools.suckless.org/wmname )并运行' wmname LG3D '。它将实际窗口管理器的名称更改为LG3D,并且Java认为它是兼容的WM。

I've found solution! The problem is that java has some problems with some window managers. Solution is simple - just install wmname utility ( http://tools.suckless.org/wmname ) and run 'wmname LG3D'. It changes actual window manager's name to LG3D and java consider it as compatible WM.

我在遇到问题之前就知道这一点。因此,我试图在.xinitrc文件中全局设置LG3D名称,但它似乎无法正常工作。我必须在将运行某些Java应用程序的每个终端中明确地调用 wmname LG3D

I know this before my problem. So I am trying to set the LG3D name globally in .xinitrc file but it looks like not working. I have to call 'wmname LG3D' explicitely in every terminal which will run some java apps.

这篇关于JFrame在Awesome WM中的位置和pack()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆