我创建了一个使用java.swing
的Java GUI
当我运行我的程序时,UI是像素化的:
这是我所有组件的面板:
public GuiPanel(){
super();
this.setBorder(new EmptyBorder(10, 10, 10, 10) );
//Layout:
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
this.setLayout(gridbag);
setUpJButton();
//textField
c.fill = GridBagConstraints.HORIZONTAL;
setUpTextField();
c.gridwidth = GridBagConstraints.REMAINDER;
gridbag.setConstraints(textField, c);
c.gridwidth = 1;//reset gridwidth
this.add(textField);
c.insets = new Insets(10, 0, 0, 0);//padding to top
//anmelden Button
c.fill = GridBagConstraints.RELATIVE;
setUpJButton();
c.gridwidth = 1;
c.anchor = GridBagConstraints.LAST_LINE_START;
this.add(logInButton, c);
c.insets = new Insets(10, 5, 0, 0);//padding to left
//abmelden Button
c.fill = GridBagConstraints.RELATIVE;
c.anchor = GridBagConstraints.LAST_LINE_END;
c.gridwidth = 1;
this.add(logOutButton, c);
}
我已经玩了几个小时,但我没有找到解决这个问题的方法。
答案 0 :(得分:1)
这看起来像是一个OpenGL问题。用户界面组件的绘制通常是硬件加速的。特别是Java中的OpenGL和DirectX。你可以尝试
-Dsun.java2d.opengl=false -Dsun.java2d.d3d=false
作为命令行选项传递给JVM来回退到软件渲染。您可以在本文中找到控制Java2D中呈现的完整选项列表:https://docs.oracle.com/javase/7/docs/technotes/guides/2d/flags.html