Eclipse Swing WindowBuilder returns error when trying to set border

北城余情 提交于 2019-12-12 22:17:08

问题


I'm encountering a problem with Eclipse's Swing WindowBuilder.

When I click on the border options button to edit the border of the jPanel:

I get the following error:

I am running on Mac OS X 10.8.4. With the following Eclipse version, and WindowBuilder version.


回答1:


WindowBuilder has many, many, many problems. It looks like you've found one of them. I had no problems trying to set the border using the same method as you, even though I am using the same version of eclipse as you.

Workaround:

To add a border, try switching to the code view and changing: contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

To: JBorder myBorder = BorderFactory.createLineBorder(Color.black); contentPane.setBorder(myBorder);

Check out http://docs.oracle.com/javase/tutorial/uiswing/components/border.html and http://docs.oracle.com/javase/7/docs/api/javax/swing/BorderFactory.html for more information on creating borders.



来源:https://stackoverflow.com/questions/17594116/eclipse-swing-windowbuilder-returns-error-when-trying-to-set-border

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!