所有图像均显示为像素化

所有图像均显示为像素化

本文介绍了Java Swing,所有图像均显示为像素化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Java Swing程序中的每个图像都会以低质量显示,如下所示:

Every image in my Java Swing Programs will appear in low quality as shown below:

从图像中可以看到,不仅是我遇到问题的图像,而且通常是这样显示的图形.在右侧部分中,您可以看到问题已反映到JFreeChart图形上.还有其他人遇到过这个问题吗,这与图形卡或Windows DPI有关吗?相同的程序将在其他计算机上完美呈现,因此我很确定它与代码无关.

As you can see from the image, it is not just images I am having problem with, it's graphics in general displaying like this. In the right portion you can see the problem reflected to a JFreeChart Graphic. Has anyone else had this problem, is it related to the graphics card or maybe windows DPI? The same programs will render perfectly fine in other machines so I am pretty sure it is not related to the code.

推荐答案

我的问题是我在Windows上以125%的比例打开了缩放比例,必须缩放图像和框架以适合它们的大小.给定的.您所要做的就是转到显示设置",然后在比例和布局"部分将缩放比例设置为100%.

The problem in my case was that I had scaling turned on at 125% on Windows and images and frames had to be zoomed in order to fit the size they were given. All you have to do is go to Display Settings and at section Scale and layout set zoom to 100%.

如果您不想降低缩放比例,可以通过添加以下参数将此参数添加到IDE上的VM:

If you don't fancy turning down scaling you could add this parameter to the VM on your IDE by adding this parameter:

或者,如果第一个不起作用,请尝试此操作.

Alternatively, try this if the first one doesn't work.

这仅适用于Swing

This only works for Swing

这篇关于Java Swing,所有图像均显示为像素化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 04:36