简体   繁体   English

如何在桌面 Java 应用程序上更改字体大小?

[英]How to change font size on a desktop Java application?

I wrote a program, exported it as ".jar" and ran it on a computer other than my developer desktop PC.我编写了一个程序,将其导出为“.jar”,然后在我的开发人员台式 PC 以外的计算机上运行它。 The problem arose that the entire JFrame on the laptop was smaller and therefore certain texts were replaced with "..." because the component was too small to display it completely.问题出现了,笔记本电脑上的整个 JFrame 较小,因此某些文本被替换为“...”,因为组件太小而无法完全显示。 Now the question arises is there the possibility to change my text size dynamically that it is always getting displayed completely?现在问题出现了,是否有可能动态更改我的文本大小以使其始终完全显示?

Edit 1: My problem is that I first have to get the font size at which my text is replaced by "...".编辑 1:我的问题是我首先必须获得将文本替换为“...”的字体大小。

|that is the code| |那是密码| |这是代码

|that is how the gui should look (It looks like this on my desktop pc)| |这就是 gui 的外观(在我的台式电脑上看起来像这样)| |这就是 gui 的外观

|that is how the gui looks on my laptop| |这就是 gui 在我的笔记本电脑上的样子| 这就是 gui 在我的笔记本电脑上的样子

I have not really a solution to the problem but I know what was the fault.我还没有真正解决这个问题,但我知道问题出在哪里。 My windows was scaled to 125% so some text dissapeared...我的 windows 被缩放到 125%,所以一些文字消失了......

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

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