Java JFrame像素化组件
我使用Java JFrame像素化组件,java,swing,user-interface,Java,Swing,User Interface,我使用Java.swing 当我运行程序时,UI是像素化的: 这是我的面板,包含所有组件: public GuiPanel(){ super(); this.setBorder(new EmptyBorder(10, 10, 10, 10) ); //Layout: GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints();
Java.swing
当我运行程序时,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);
}
我已经谷歌搜索了几个小时,但没有找到解决这个问题的方法。这看起来像是OpenGL的问题。用户界面组件的绘制通常由硬件加速完成。特别是Java中的OpenGL和DirectX。你可以试着
- 更新你的驱动程序
- 通过将
-Dsun.java2d.opengl=false-Dsun.java2d.d3d=false作为命令行选项传递给JVM,尝试返回到软件渲染
在本文中,您可以找到一个完整的选项列表来控制Java2D中的渲染:报告了类似的问题,我认为问题是由驱动程序问题引起的。如果可以,请升级您的驱动程序。重复