-->

Eclipse Swing WindowBuilder returns error when try

2019-07-20 06:00发布

问题:

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.