Empty Dropdown list for properties of a custom Java Bean in Eclipse WindowBuilder

huangapple go评论65阅读模式
英文:

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组件的属性中那样出现。相反,当我单击它时,会显示一个箭头,并显示一个空的下拉列表:

Empty Dropdown list for properties of a custom Java Bean in Eclipse WindowBuilder

我已经尝试了许多不同的方法,但无法编辑我的属性。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:

Empty Dropdown list for properties of a custom Java Bean in Eclipse WindowBuilder

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.

huangapple
  • 本文由 发表于 2020年8月11日 17:04:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/63354981.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定