Swing中的哪个字体在所有操作系统中看起来都一样? [英] What font in Swing looks the same in all OS?

查看:333
本文介绍了Swing中的哪个字体在所有操作系统中看起来都一样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7下使用带有JDK6的Netbeans 7.0来设计我的Java应用程序的用户界面。我应用系统外观。但它在Windows中看起来像我想要的但在MacOS上有所不同,更糟糕的是,它在Linux中的不同窗口管理器(LXDE,GNOME,KDE,XFCE)中看起来有所不同。

I use Netbeans 7.0 with JDK6 under Windows 7 to design the user interface of my Java application. I apply System look and feel. But it looks the way I want in Windows but differs in MacOS and even worse, it looks different in different window managers in Linux (LXDE, GNOME, KDE, XFCE).

不同意思是字体外观和尺寸。在Windows中,如果标签看起来是v 1.23,则在其他操作系统中看起来像v ...,因为在该操作系统中字体变大,而JLabel没有足够的位置显示。这种情况发生在几个地方。

By different I mean the fonts look and their size. In Windows, if a label looks "v 1.23", it looks like "v ..." in other OSes because the fonts become bigger in that OS and the JLabel do not have enough place to show. This happens in several places.

我不想增加标签宽度。我希望所有操作系统中给定宽度的标签看起来都一样。默认情况下,Netbeans在我的电脑上使用字体Tahoma 11pt。我认为它并非在所有操作系统中都可用,因此其他操作系统使用不同的字体。

I don't want to increase the label width. I want the label to look the same in that given width in all OS. By default, Netbeans uses the font Tahoma 11pt on my pc. I think it's not available in all OSes so the other OSes use different font.

Arial是一种常见的字体吗?

Is Arial a common font?

我应该手动将每个元素的字体更改为Arial吗?或者其他任何选项?

Should I change the font of every element to Arial manually? Or any other options?

推荐答案

说到窗口管理器,它还有很多东西,比如字体大小,例如在gnome&中,两个控件之间的宽度处理方式不同KDE。当它涉及在所有平台上使用相同的字体大小时,您可以使用 Sans Serif 字体,这在我使用的所有操作系统中都可用。

When it comes to window managers there is a lot more to it than just font size, for instance the width between 2 controls are handled differently in gnome & KDE. when it comes down to using the same font size across all platforms you can use Sans Serif font, this is available in all the OS'es I've worked with.

它也会更好(如果你在运行你的应用程序的操作系统中找不到serif)你可以下载一个字体(免费的GNU免费字体

it would also be better (if you can't find serif in an OS where you want to run your app) you can download a font (free ones from GNU Free Fonts).

设置字体大小和放大器;字体,你为什么不尝试使用主题&在那里设置字体...
你可以使用 UIManager.setLookAndFeel()方法来改变主题。
这里是 Look& amp;感觉

when it comes to setting the font sizes & the fonts, why don't you try using a theme & set the font there... you can use the UIManager.setLookAndFeel() method to change themes. here is a link on Look & Feel

这篇关于Swing中的哪个字体在所有操作系统中看起来都一样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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