I use a customised renderer for rescaling the screen for my 8 bit computer emulators that works nicely in pre Java 9 environments. In Java 9, it creates triangular distortions on the main screen when the JVM automatically resizes the screen to accommodate for different resolutions. It is most noticeable when scan lines are enabled in the emulator. I'm suspecting it has something to do with this ==> http://openjdk.java.net/jeps/263 being delivered in Java 9.
As an example, the effect can be seen when executing the following program on a 4K monitor using Java 9 on Windows 10.
public static void main(String[] args){
JFrame frame=new JFrame("Java version 9");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
BufferedImage image =new BufferedImage(800,600,BufferedImage.TYPE_INT_RGB);
Graphics2D g=image.createGraphics();
g.setColor(Color.WHITE);
for(int y=0;y<image.getHeight();y+=2){
g.drawLine(0,y,image.getWidth(),y);
}
g.dispose();
ImageIcon imageIcon=new ImageIcon(image);
JLabel label=new JLabel(imageIcon);
frame.add(label);
frame.pack();
frame.setVisible(true);
}
The following is how the same program looks using JDK 1.8.0_144, which is the desired result.
Is there a way to disable the default automatic rescaling of screens in Java 9 that will be compatible with pre Java 9 environments as well?