Comparison of Two Methods to beautify the jframe Interface
To make the jframe interface more beautiful, you can use the jbuton and jlabel with icons for GUI programming in Java.
The jbutton is used for embellishment. The example interface is as follows:
The example interface is as follows:
Comparing the two images, we can easily find that the jbutton method is like hanging the jbutton on the jframe first and then pasting the image on the jbutton; using jlabel is like directly attaching an image to a jframe. Therefore, it is obvious that jframe uses a jlabel with an icon for vertices to achieve more beautiful results.
Note: When jlabel is used to embellish jframe, images may not be displayed during running. I have encountered similar problems during my experiments. I think this may be related to the operating system, because I am running on my computer and cannot always run the jlabel with images, however, I run the same program on the computer in the school data center to achieve the expected results. The running effect on your computer is as follows: