linux java 屏幕分辨率,Linux全屏幕Java - 如何覆盖任务栏?

I have a problem to run Java application in full screen mode on "openSUSE 11.4 (x86_64)". I am using Java 1.6.0_26-b03.

I have try to run two examples of full screen application:

Example from Oracle site: Display Mode Test.

JDarkRoom.jar (simple text editor) downloaded from Codealchemists.

In both cases I have a Linux Task bar visible over the application. It must be something with system settings/configuration?

解决方案

You should be able to go “really full screen” with GraphicsDevice.setFullScreenWindow (window). However, due to bugs in the most popular Java runtimes, this may not work on systems running certain “broken” versions in the 1.6 = Java 6 series. I haven't tested this thoroughly, so it may be that the patch hasn't propagated out to the general populace, yet.

Background/Theory

OK, so here goes for too much information, and not enough help… Here's a bit of why this didn't work right…

There is no Linux Desktop

Linux-based operating systems on PC-type machines, as well as other Unices (with a partial exception for MacOSX), normally use the X Window System (aka X11). Under X, you have an X Server (usually, something kinda like a “video driver”) and clients that connect to it, more often than not, from the same machine (loopback).

The layout and placement of windows is controlled by a special client program, called the Window Manager. It's responsible for decorating the windows (e.g. drawing title bars or resize handles) and positioning them.

Your program would be an X client. It can request — but not demand — placement on the screen at a certain position, or a certain size. Various Window Managers are more (or less) prone to giving you what you want.

Except, most desktops play nicely (sometimes)

Now, by far, most Linux desktops use the Gnome Desktop, with a strong second place for the K Desktop, and a few others are in fairly wide use. What's “nice” is that both of these desktop environments (as well as some others, like XFCE for low-end PC's) conform to the FreeDesktop.org Window Manager Hints standards.

(Super-over-simplification:) Typically, there will be Panels on one or more edges of the screen. Usually, there's just one, across the top, but there are many variations. These Panel areas are not considered “part of the screen,” so the Window Manager tells your application, “no, that's outside of the area in which you're allowed to play; this screen is not 1920×1080, it's only 1890×1080.” Of course, that could be totally different arrangement than what you'd anticipated when you wrote your app, and you might be on my netbook with a physical screen of 800×480 pretending to be only 780×480.

For 99% of apps, that's great. Windows don't get in the way of the Panels, so you can always reach the Panel for critical controls, like hitting Mute or switching to another program or something.

These “hints” allow you to request that your top-level windows get treated specially. For example, you can request that you get no title bar — or a reduced, “palette” type title bar; you can request to be skipped on the window list or task bar or activities overview or whatever other interface might be used to show the active windows; or, you can request to go really full-screen, and push everything else out of the way, even panels.

And the Fail:

Basically, the window manager hints specification wasn't being followed correctly by Sun/Oracle (or Red Hat, who copied off Sun/Oracle, or probably IBM, because they probably did the same, but I don't see anybody complaining about them)…

Although, I do see some griping back and forth about whether it's a bug (specifically) with the K Desktop Environment's window manager (KWin), as apparently this bug only shows up in K, and not in Gnome, XFCE, and friends.

Work-Around

Aside from patching your Java runtimes (and/or your customers'), the only real fix would be to use the platform-specific Java libraries (perhaps grab the underlying AWT objects using reflection… eww…) and set the proper window hints, yourself.

Yes, that's gross…

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。
Linux操作系统中,要调节屏幕分辨率,可以按照以下步骤进行操作: 1. 打开控制终端,输入命令`xrandr`,可以查看当前可用的屏幕分辨率选项,带有*的是当前的分辨率选项。\[1\] 2. 如果你想改变分辨率,可以使用命令`xrandr --output <屏幕名称> --mode <分辨率>`,将"<屏幕名称>"替换为你的屏幕名称,"<分辨率>"替换为你想要设置的分辨率。例如,如果你的屏幕名称是"LVDS-1",想要设置分辨率为1920x1080,可以输入命令`xrandr --output LVDS-1 --mode 1920x1080`。\[1\] 3. 如果你想将新的分辨率设置为默认分辨率,可以编辑Xorg配置文件。在终端中输入命令`sudo nano /etc/X11/xorg.conf`,打开Xorg配置文件。在文件中找到"Section "Screen""部分,添加一行"Option "PreferredMode" "<分辨率>"",将"<分辨率>"替换为你想要设置的分辨率。保存文件并退出。重新启动系统后,新的分辨率将成为默认分辨率。\[1\] 请注意,具体的命令和步骤可能会因不同的Linux发行版而有所差异。建议在进行任何更改之前,先备份相关文件,以防出现意外情况。 #### 引用[.reference_title] - *1* [修改虚拟机中屏幕分辨率的方法(Linux)](https://blog.csdn.net/Captain_Aaron/article/details/120176645)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值