-1

I have created a Java GUI useing java.swing
When i run my program the UI is pixalated:

enter image description here

this is my Panel with all the componets:

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);
}

i've been googeling for hours but i didn't found a solution for this problem.

YvesHendseth
  • 1,149
  • 1
  • 10
  • 27
  • There are similar problem reported and I think the problem was caused by a driver issue. Upgrade if you can your drivers. – Eypros Nov 17 '14 at 10:15
  • 1
    Duplicate [Swing rendering appears broken in JDK 1.8, correct in JDK 1.7](http://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7) – Catalina Island Nov 17 '14 at 11:19

1 Answers1

1

This looks like an OpenGL problem. Drawing of user interface components is usually done hardware accelerated. Specifically with OpenGL and DirectX in Java. You can try to

  • update your driver
  • try to fall back to software rendering by passing -Dsun.java2d.opengl=false -Dsun.java2d.d3d=false as command line option to the JVM.

You can find a whole list of options to control the rendering in Java2D in this article: https://docs.oracle.com/javase/7/docs/technotes/guides/2d/flags.html

Simon
  • 1,814
  • 20
  • 37