Java 9 on Windows with large fonts - java

If you set large fonts (for example, 125%, 120 DPI) on Windows, then it looks as if Swing of Java 9 first renders into a smaller image and then scales this image to the screen.
Text is still properly displayed. But 1 pixel lines are times 1 pixel or 2 pixels strong. A diagonal line is stepped. Icons are rasterized.
Are there any command line parameters or API to change this behavior?
Example Edit:
Using MenuSelectionManagerDemo from docs.oracle.com/javase/tutorial/uiswing/examples/components/

I ran that Swing MenuSelectionManagerDemo using Java 9 and Windows 10, and the issues you raised appear to be resolved. See the two screen shots below, where I ran with scaling set to 100% and 125% respectively.
As I pointed out in a comment to the OP, it looks like this was resolved by a JDK bug fix several months ago, which I assume was raised by the OP:
https://bugs.openjdk.java.net/browse/JDK-8174845
One other minor point worth noting is that changing the Windows setting from 100% to 125% is a change to "Scale and Layout", and will "Change the size of text, apps and other items". (i.e. It is far more than just a font change, as mentioned in the JDK bug response.)

I found that on Oracle Java 9,10,11,12 and Amazon Corretto Java LTS (jdk 11.0.2_9) and the rasterization problem with icons/pictures are still a valid case and not fixed! Is this bugfix merged to trunk really?
Last version where this problem is not occurred is Java 8.0_202 where still everything goes well.

Related

netbeans problem on showing text within nimnus look and feel

When I set my Netbeans look and feel to nimbus and a small font seems great .
But when I set the font size to 14(or bigger than) some size of texts are OK but others will be made smaller than like size 10(though I set the font size to 14).
the covered areas with green mean that the font within them are set great.
the covered areas with red mean than the font within them are set incorrect (smaller than gotten value)
Gtk THEME:
Nimbus Look And Feel :
OS : Linux Manjaro
Jdk : open jdk 14
Environment : GNOME
Netbeans : Apache Netbeans 12
"It probably happens only on Linux and might be a java SE problem not a Netbeans problem"
It seems that the problem is within the Java on linux as it has some problem with javafx media players in linux as well.
Also as I tested other look and feels the only problem is in the nimbus and I have to report it to Oracle.

Java, why do my lines always white out in BlueJ?

While typing my code out, some lines automatically get spaced out, and whenever I try to click or type something, more lines disappear in the process, therefore making me delete the class itself.
I have encountered this same issue on another system.
I cannot even Ctrl+A my code, help!
Screenshot:
The BlueJ FAQ mentions possible display artifacts on Windows:
There are visual artifacts on the BlueJ windows (black areas,
distorted text, etc) in Windows
Visual artifacts - black areas,
distorted or missing text, etc - are usually a result of either a
display driver bug or a Java bug. Try updating your display drivers
(see here for Windows 7) or disabling graphics acceleration (see
here).
https://bluej.org/faq.html#win_visual_artifcats
It makes several recommendations for how to fix them:
update display drivers
update JDK
change VM args
Read the linked FAQ for instructions.
The release log also tells a similar story, so make sure you've updated BlueJ:
4.1.0 23 June 2017
Major fixes:
Fixed: Graphical display bug could cause the Java editor and other
windows (e.g. Terminal) to turn white and not redraw correctly.
https://bluej.org/versions.html

Raspbian JavaFX VERY VERY SLOW

Hello Stackoverflow Community!
I am facing a problem,
when I want to execute my self-written JavaFX runnable Jar file program (it is a Chess game).
When I execute the program it needs about ten seconds to start.
After the start, when I want to select a piece or the menu items there are two possible options:
The Gui freezes completely after startup
I may click on a piece and it needs around 5 sec. to select it and when I want to hover (no self-written event) on the JavaFX menubar, the PI freezes for about 5 sec. and then displays the blue hover color.
I have a Raspberry PI 3.
I have currently installed the Java Environment: ,,openjdk version "1.8.0_40-internal" ($ java -version)
I added manually the JavaFX files (they are not included in this openjdk version) as it is mentioned at:Gluonhq -section 2.1.4
I run the Jar file with: java -jar Chess.jar -> Chess.jar is jar file
The game runs without these errors on Linux Mint (openjdk version "1.8.0_131") and Windows 10.
I don´t know what is the source of the problem. Maybe JavaFX on the PI is simply not a good idea?
Anyway thanks for the help,
Alex
Thanks for your quick answers and suggestions, but today I found the solution (tldr; including images of the meeples lead to exceptions, which lead to a bad performance. Removing the images improved the performance):
#Joe C - with my next question I will specify the problem more clearly ;)
#sillyfly - no but thx. for your answer
#Josê - Yes I tried. The first program I used gave me the same bug, but today I tried another self-written one -> this one worked fine -> see below
The problem was that the PI couldn't render my Meeples (they were basically images). I found this out using the stack trace of the PI. Two days ago I couldn´t access the stack trace, due to an impossibility of exiting the game, now I developed an exit function, and here goes the stack trace. It showed me, that there is a null pointer at com.sun.prism.impl.BaseGraphics.drawTexture(BaseGraphics.java:4000) - this is for rendering Images (as far as I know).
Today I removed my meeple images. I don´t know why the PI can´t render these images but it works fine now :)
-Alex

Java program not displaying on high DPI screens

I am very new to Java programing but am managing a deprecated Java software as a part of my job. The old program renders perfectly on lower resolution screens but as the company moves to a higher DPI line of devices (primarily Microsoft Surfaces), the program is very small. I found many ways online to adjust the resolution of other programs through the use of Manifest files but can't seem to get anything to work. I also saw that the swing.properties file can be changed to fix it, but the program doesn't use swing. Are there any external files that can be used to change the resolution for this program?
The issue arises on Windows 10 high DPI devices and the program comes with it's own version of Java installed in the users AppData folder and thus does NOT use the Java installed regularly on the device.
I had the same problem and tried several different solutions with limited success. The only one which worked for me was to adjust the properties of the java.exe and/or the javaw.exe executables as described in this superuser answer:
https://superuser.com/a/1207925
This worked perfectly for me.

UI components of java programs appearing as blank boxes

As I run Java programs (like DbVisualizer and OpenProj) on my computer, some UI components like buttons, images, check boxes, scrollbars, etc. show as blank boxes. Not rarely some of these components first appear normally when you open the program and then go blank as you mouse over them.
I have already updated JRE and video drivers and also tweaked JAVA_OPTS with -Dsun.java2d.noddraw=true;-Dsun.java2d.d3d=false;, as recommended in Java forums, but none of these proposed solutions have worked so far.
I don't believe this is an OS specific issue, since I checked some other PCs with the exact same configuration of OS (Windows Vista) and hardware and many of them don't present that problem.
A screenshot of this situation can be seen here:
Any ideas?
Those JAVA_OPTS must be separated by spaces and not semi-colons!
Connect to the application with jVisualVM and verify that the "JVM Arguments" section contains all your desired options.
While using windows basic theme I would often find numerous graphical glitches. Moving a window would create a trail behind itself over background windows and UI controls at times would not appear until moused over.
As already suggested, try using the windows aero theme and just turn off transparency if you don't like the aero look.
This does seem more like a graphics driver issue. Note how things that are missing are images (icons, checkboxes) which are drawn by transferring the bitmap data directly to the graphic card. The sun.java2d.noddraw=false and sun.java2d.d3d=false are more of a hacks in this case, really.
What I would do is:
check if I am using the latest version of Java (wouldn't hurt to switch to a 64-bit java if you are using a 64-bit system)
check your graphics drivers, make sure they are the latest version
check Windows service packs
Also try using changing the Look and feel; maybe this will help.
I suspect that disabling DirectDraw will fix this and your attempt to disable it was unsuccessful.
As noted by Ryan, the options appear to be formatted incorrectly. Remove the semicolons and put a space between, or better still, only use sun.java2d.d3d=false. The sun.java2d.noddraw flag was obsoleted Java SE6u10 and setting to true now has the same effect as setting sun.java2d.d3d=false. There is no need to set both.
The effect of the incorrect formatting can be seen in the code below:
public class WrongArgs {
public static void main(String[] args) {
System.out.println("sun.java2d.noddraw: " + System.getProperty("sun.java2d.noddraw"));
System.out.println("sun.java2d.d3d: " + System.getProperty("sun.java2d.d3d"));
}
}
Running this code with args: "-Dsun.java2d.noddraw=true;-Dsun.java2d.d3d=false;" produces:
sun.java2d.noddraw: true;-Dsun.java2d.d3d=false;
sun.java2d.d3d: null
Running with args "-Dsun.java2d.noddraw=true -Dsun.java2d.d3d=false"
sun.java2d.noddraw: true
sun.java2d.d3d: false

Categories