简体   繁体   English

在root用户和非root用户下,Swing GUI看起来有所不同

[英]Swing GUI looks different under root user vs. non-root user

I have a Swing GUI that I developed Netbeans Matisse in Linux. 我有一个Swing GUI,它是在Linux中开发的Netbeans Matisse。 For some odd reason, the look and feel of the application looks different when it's run by root (it looks better, actually). 出于某种奇怪的原因,应用程序的外观在由root用户运行时看起来有所不同(实际上看起来更好)。

Is there a reasoning for this? 有这个理由吗? Thanks 谢谢

Swing is a cross platform GUI. Swing是跨平台的GUI。 It renders itself by default with a look and feel which most closely resembles the platform it is running on. 默认情况下,它以与运行平台最相似的外观来呈现自己。 There are look and feels for GTK, Motif and Windows as well as cross platform themes like Metal & Nimbus. GTK,Motif和Windows以及跨平台主题(例如Metal&Nimbus)具有外观。

In Linux it will default to use the GTK theme if you have gtk 2.2 installed. 在Linux中,如果已安装gtk 2.2,则默认使用GTK主题。 It may be on your system that the GTK theme is different for root than it is for a regular user and your Swing app is reflecting that. 在您的系统上,root用户的GTK主题与普通用户的GTK主题可能有所不同,而您的Swing应用反映了这一点。 Or it may be that it can't detect GTK correctly in root and is defaulting to Motif. 或者可能是它无法从根目录正确检测到GTK,并且默认为Motif。

Try logging in as root and see if the desktop theme is the same or different. 尝试以root用户身份登录,然后查看桌面主题是否相同或不同。 Try running the app and see if it reflects the desktop theme or is something else entirely. 尝试运行该应用程序,看看它是否反映了桌面主题或完全不是其他主题。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM