smooth rounded corners in swing

前端 未结 2 1518
暖寄归人
暖寄归人 2021-02-12 15:42

I want to make smooth rounded corners for my swing application, but I can\'t get my desired result...

here\'s the screenshots:

1.setShape() for JFra

2条回答
  •  耶瑟儿~
    2021-02-12 16:02

    The only chance you have is working with regions. You will need to hardcode a bit and play with subtract, but eventually it will look fine. You can take a look at how it's done in mylyn's notification class: http://grepcode.com/file/repository.grepcode.com/java/eclipse.org/3.6/org.eclipse.mylyn.commons/ui/3.4.0/org/eclipse/mylyn/internal/provisional/commons/ui/AbstractNotificationPopup.java

    Hope it helps, best of luck!

    Edit: Just remembered this little tutorial which might help: http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/SWTShellcreateanonrectangularwindow.htm

提交回复
热议问题