简体   繁体   中英

Swing Custom GUI Component

I need to create a custom GUI Component about same like shown in the following image. it has some buttons and labels on this.

How can i create like this

自定义java Swing图像是这样的

You could use a JWindow, with an Image for the background picture. For the buttons, use a JButton with an ImageIcon.

You can have a JFrame with nullLayout then use a JLabel with the image.

Now for buttons use setContentAreaFilled(false) and setBorderPainted(false) to remove the default button style and it will look exactly like the image that you have passed while creating the button.

To position the Frame at the center use setLocationRelativeTo(null) .

I think that should solve your problem.

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