I'm having a problem with the GUI of a java project. I construct the GUI using the Netbeans GUI-build开发者_如何学Pythoner. 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:
- In Netbeans: http://i51.tinypic.com/zl3z1j.jpg
- While running: http://i56.tinypic.com/fnfwc0.jpg
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.
精彩评论