英文:
Empty Dropdown list for properties of a custom Java Bean in Eclipse WindowBuilder
问题
我正在使用Eclipse 2020-06(4.16.0)与WindowBuilder 1.9.4.202002151729。我试图创建自己的Java Bean,但当我尝试在WindowBuilder Design选项卡上更改自定义String类型属性时,我遇到了问题。问题是该属性无法编辑,旁边的三个点不会像在Swing组件的属性中那样出现。相反,当我单击它时,会显示一个箭头,并显示一个空的下拉列表:
我已经尝试了许多不同的方法,但无法编辑我的属性。Java编译器兼容性级别设置为1.8,我的Bean代码如下:
public class TestingBean extends JLabel
{
private String myString;
public TestingBean()
{
this.myString = "";
}
public String getMyString()
{
return myString;
}
public void setMyString(String myString)
{
this.myString = myString;
this.setText("My text is: " + myString);
}
}
另外,我在寻找关于这个问题的信息,但没有找到任何信息。是否有人知道是否存在类似这种问题的已知错误,或者我可能做错了什么?
提前感谢您。
英文:
I am using Eclipse 2020-06 (4.16.0) with WindowBuilder 1.9.4.202002151729. I am trying to create my own Java Bean but I am facing a problem when I try to change a custom String type property on WindowBuilder Design tab. The problem is that property is not editable, three dots next to it do not appear as they do in properties of swing components. Instead, an arrow is displayed and an empty dropdown list appears when I click on it:
I have been trying many different things but I am not able to edit my properties. Java Compiler compliance level is set to 1.8 and the code of my Bean is as follows:
public class TestingBean extends JLabel
{
private String myString;
public TestingBean()
{
this.myString = "";
}
public String getMyString()
{
return myString;
}
public void setMyString(String myString)
{
this.myString = myString;
this.setText("My text is: " + myString);
}
}
Also, I was looking for this problem and I have not found any information. Anybody knows if there is any known bug like this one or if I could be doing something wrong?
Thank you in advance.
答案1
得分: 0
将OpenJDK替换为Oracle JDK在项目 > 属性 > Java构建路径 > 库
中,并重新构建Java Bean类,这个方法对我有用。
英文:
Replacing OpenJDK by Oracle JDK in Project > Properties > Java Build Path > Libraries
and rebuilding the Java Bean class fixed this problem for me.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论