Problem with rendering in java swing

I have a java application with GUI running on ubuntu 16.04 using jre 1.7 and I got some rendering problems. The following code is not an application code, but a simple test case.

import javax.swing.JComboBox;
import javax.swing.JFrame;

public class Test {


  public static void main(String[] args) {
    JFrame f = new JFrame();
    f.setSize(400,200);

    String[] s = {"test", "of", "rendering"};
    JComboBox<String> cs = new JComboBox<>(s);
    f.add(cs);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.pack();
    f.setVisible(true);

  }
}

The following images show the problem: I have 3 elements in the JcomboBox, however, when I browse (either using the mouse or the keyboard), the display of the elements changes (which should not happen). The problem also occurs in Jtree elements. enter image description here

Any thoughts on this. Thanks in advance.

+4
source share
1 answer

, , , Oracle Java JDK 7 OpenJDK 7, .

JComboBox. Windows, , Java JDK .

, , - Swing repaint OpenJDK, , , . RepaintManager, addDirtyRegion(JComponent c, int x, int y, int w, int h) java.awt.EventQueue.isDispatchThread(), , .

JComboBox OpenJDK, Oracle JDK. , - , JDK.

P.S. , Oracle JDK 7 Ubuntu APT, RPM, deb- - Oracle Java JDK 7 Ubuntu Linux - RPM

+2

Source: https://habr.com/ru/post/1687737/


All Articles