inconsolata and netbeans - java

When I installed inconsolata everything looked fine, however when I tried viewing it on netbeans it look like this:
I tried using both the ttf and otf versions and they both looked messed up.
Is this a java issue? Win 7 64 bit issue? Is there any way to fix this?

You could try disabling font antialiasing in NetBeans.
Open up your netbeans.conf
As part of the netbeans_default_options section add -J-Dswing.aatext=false -J-Dawt.useSystemAAFontSettings=off.
Edit: fvu also provided a helpful link to a relevant section in the NetBeans font rendering FAQ.

If you want to play around with NetBeans font rendering settings, take a look at http://wiki.netbeans.org/FaqFontRendering
Unfortunately, what this article concludes is that default font rendering settings provide the best possible experience. At least under Windows. I have tried all the possibilities with Inconsolata and defaults provide the the best look indeed.
As a workaround, you can try two things:
Decrease contrast of your color scheme, i.e. by decreasing lightness of a background and/or increasing lightness of your font. It makes font rendering issues less visible.
Use NegativeScreen: http://arcanesanctum.net/negativescreen/
You may find your experience improved, but this is up to your personal preference.

It's not just NetBeans, although it is probably not simply the Inconsolata font's fault either. There seems to be a problem at the level of the underlying Java system that NetBeans is built on. I say this because the exact same problem shows up in the IDEs created by Jetbrains -- IntelliJ IDEA, WebStorm, PyCharm, and possibly others.

Related

JavaFX: Turn off font smoothing

(There are several similar question, but no answer worked)
I started experimenting with JavaFX (JDK8) and first thing I noticed is a horrible font smoothing. I'm using Windows 8.1 and disabling font smoothing/ClearType OS-wide was one of the first things I did. This is respected by most apps (two notable exceptions being IE and Metro UI stuff), but JavaFX seems to be forcing it.
Here's screenshot illustrating it - code snippet in Eclipse IDE and resulting JavaFX window (code is in Scala, but very readable). They both use the same font, so the difference is obvious.
As you can see, I tried setting
System.setProperty("prism.lcdtext", "false")
System.setProperty("prism.subpixeltext", "false")
but they seem to have no impact whatsoever.
Any hint or insight on this issue?

How to set the DPI of Java Swing apps on Windows/Linux?

If you have an monitor with a DPI over 150 (such as Macbook Pro), you may also find the problem: the font on the Java Swing app is too small for high DPI monitor, and I cannot change the font size at all ( It ignores the Windows DPI directly, only displaying the very original DPI-->96 ). I can do nothing but changing the screen resolution, which could absolutely make everything blurry on LCD.
Yes, I have a laptop with a high DPI monitor, 15.6' with 1920x1080 resolution, some Java desktop apps look very small on my laptop, such as Matlab, Burpsuite etc. I have been searching the Internet for a very very long time, but still cannot find a method for the problem. I know I can change the JRE fonts through JRE_HOME/lib/font/fontconfig.properties.src, but I cannot find any place to set the default font size or DPI for Java desktop fonts.
Does the problem have no solution? Do you have a high DPI monitor? How do you do with such apps? Does Swing give up high DPI users?
I'm currently investigating this issue on Windows. Here's what I found:
Most Swing Look & Feels don't support high DPI at all, not even Nimbus even though it's supposed to be scalable. I found some old blog posts saying that Nimbus might eventually offer high DPI scaling, but apparently that never happened.
The one exception is System LAF but its default font is ~10% smaller than the actual system font size, at all DPI settings. Moreover, System must be selected explicitly as described here:
http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
There's no single scaling factor that you could set in Swing, either. The specific LAF has to provide code to handle scaling. So the best you can do is select System and hope it's good enough.
However, JavaFX does correctly and automatically scale all the way up to 150% on my system. If at all possible, I suggest you use JavaFX to build your GUI.
edit: I made a couple small test programs and took comparison screenshots for various GUI frameworks, Swing themes, and DPI settings. This might be informative for people reading this question: http://kynosarges.org/GuiDpiScaling.html
Short answer: You need to run it on JRE 9+.
Long answer:
This is because the Java runtime declared itself to be "DPI-aware" but didn't really supported it for AWT and Swing. Java applications were sized and rendered based on pixels rather than being properly scaled, this included HiDPI displays.
Anyways, this has been recently solved.
See the issue JEP 263: HiDPI Graphics on Windows and Linux
and the upgrade.
So, increasing the font size does not work (because it does not increase the rest of the things); the jvm argument -Dsun.java2d.dpiaware=false does not work (because it is not really supported); and the manifest file + registry edit (for Windows) just does not work.
Solution: You need to run it on JRE 9+ because it really supports this feature.
This answer solved the issue on my 4K-screen Ubuntu laptop.
In the application's config file, I added the -Dsun.java2d.uiScale=2.5 Java parameter and now, upon executing, the application is scaled well and is usable.
It appears that on Linux (Gtk) you can work around this by scaling the Apps DPI using the following before starting the app.
export GDK_SCALE=2
(You can also reduce you monitor resolution but that's no solution at all).
On Linux, it doesn't seem possible to do scaling with any Swing look and feel, according to my experiments. However, it is possible to do it using a hack involving VNC, vncdesk. Here is my configuration for running gradle --gui under vncdesk:
.vncdesk/1/settings.ini:
[desktop]
width = 1050
height = 650
[window]
title = gradle
name = gradle in vncdesk
class = GradleInVncdesk
scale_factor = 2
.vncdesk/1/startup:
#!/bin/sh
cd "$INVOCATION_DIR"
matchbox-window-manager&
exec gradle --gui "$#"
I managed to solve it following these instructions: Link.
It's in German, but I will translate the important stuff.
Create this registry-key:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide]
"PreferExternalManifest"=dword:00000001
Create a manifest file with this content:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*">
</assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="amd64" publicKeyToken="1fc8b3b9a1e18e3b">
</assemblyIdentity>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<ms_windowsSettings:dpiAware xmlns:ms_windowsSettings="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</ms_windowsSettings:dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
Copy it into the bin directory where the java.exe and javaw.exe is inside and named it java.exe.manifest and javaw.exe.manifest (You will have two files with the same content but different names).
HTH.
Bernd
As #demented hedgehog said setting the GDK_SCALE=2 environment variable does work under Linux.
If you are using JetBrains IntelliJ you can set Enviroment variables just for your project under Edit configurations > Build and Run > Enviroment variables
You can see below where to put the GDK_SCALE=2.

How to make Java Swing application developed in NetBeans not have hideous buttons?

I developed a Java application in Netbeans, and I'm going to release it soon so I'm working on making it less ugly. Since I'm developing on a Mac, the GUI builder uses the Mac Look & Feel, which looks decent, but many of my users won't be using Macs. The default L&F is Nimbus, which looks fine except for the buttons, which have annoying borders that are not overridden by the manually setting the borders (you can see how the manual borders look in the image). With the manually set borders, the Nimbus L&F adds its own odd border inside the border I made, which just looks idiotic. Without the manually set borders, Nimbus's borders overlap in visually unappealing ways, and in order to avoid overlap I have to space the buttons really far apart, which I also don't like.
I tried using the other L&Fs available in Netbeans (Metal and something else), but they're just too ugly to stand.
Basically, I would like some advice on how to customize the way buttons look in this application. I don't want to write a button drawing function from scratch or design my own images. I just want a way to change the settings so things don't look stupid. I read in various places that the Substance L&F is good, but I can't find where to download it anywhere. If someone could link me to a download page for Substance or recommend another popular, simple and not stupid-looking L&F, I would greatly appreciate it.
Yeah pretty much all the L&Fs you'll find in Netbeans are worse than the default. The program will use the default Look & Feel of the operating system - so if it's being run on Windows it will have the "Windows-esce" buttons and fonts and on Mac will have the Mac style.
It all depends on what you're looking for. If you're application is meant to be professional and you don't mind it having different styles depending on the OS of the user then I'd leave it as default. It lends familiarity to your program which can truly make the user feel much more comfortable.
If you're after an indetical look for all users then, as you know, you just need to include the L&F with your program. I couldn't find a download for Substance but there are a few L&F's here - both commercial and free.
http://www.java2s.com/Product/Java/Swing/Look-And-Feel-LaF.htm

Java text-antialiasing: how to debug when not working?

I'm working on a fairly big Swing-based app (JPanels, JLabels, etc) and I have to find out why text-antialiasing (on JLabels etc) is not working.
As you may know, antialiasing normally works automagically (with Java 1.6 anyway), that is, when one creates a simple Swing-app (for example, just a JPanel with a JLabel on it) the text on the JLabel will be antialiased out of the box. No need for System.setProperty("awt.useSystemAAFontSettings","on") and/or System.setProperty("swing.aatext", "true").
But this app is different, it does not antialias out of the box, it does not antialias with System.setProperty("awt.useSystemAAFontSettings","on") and/or System.setProperty("swing.aatext", "true") in the main(String[] args), on also not with -Dawt.useSystemAAFontSettings=on and/or -Dswing.aatext=true as VM-arguments. I've tried these and other all suggestions I could find on this site and on internet, but to no avail: this app just never antialiases, whatever I do or don't.
I'm out of options now. So my questions are:
What steps can I take to find out why antialiasing is not working ?
What properties should I check ?
What code should I trace with the debugger ?
What circumstances could cause antialias not to work ?
All insights are welcome.
Try the advice in System Properties for Java 2Dâ„¢ Technology: awt.useSystemAAFontSettings.
As of 1.6, it looks like swing.aatext is ignored. However, as noted by #Andrew, awt.useSystemAAFontSettings should work...
One of the things you might want to do is dump out the Map for the awt.font.desktophints desktop property just to see what, if anything, has been set.

SWT on OSX: Windows open under other applications

I'm having trouble with my SWT application where the shells/dialogs always open underneath other windows by default ("pop-under"). if I set the SWT.ON_TOP bit, the window opens properly on top, but then I block other applications, which isn't really desirable either...
I'm wondering if there's a proper way to specify that I want the window to pop-up, rather then underneath other applications.
Thanks!
I think this question is a duplicate of this SO question. What's your SWT version? It should be resolved in the latest version, as is explained there. Also see this bug report at Eclipse.org.

Categories

Resources