简体   繁体   中英

NetBeans JFrame GUI all JLabels are grayed out when running

I'm having a problem with the GUI of a java project. I construct the GUI using the Netbeans GUI-builder. In the construction field, more specifically, Netbeans all the JLabels appear deep black but when I run the file (shift-F6) all the JLabels appear grayed out. Here are some screens to clarify the problem:

What could be the cause of this problem?

This may be a look-and-feel problem. I seem to recall that the Netbeans GUI builder uses your system native look-and-feel. By default, however, your application will probably use the Swing LAF (the name of which I forget just now). This means that when you run the application, you won't see the same LAF as you see in the GUI builder. The colors used by the two LAFs are slightly different.

See this Java help page for some options on setting the look and feel. However, since it looks like you're going for a custom look anyway, you might be better off setting all of your colors explicitly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM