带双引号的Jcomponent属性

时间:2015-06-05 14:34:43

标签: java jcomponent swingx

我有一个与此代码相关的问题

public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
        String property = propertyChangeEvent.getPropertyName();
        if ("background".equals(property)) {
          button2.setBackground((Color)propertyChangeEvent.getNewValue());

您能否向我解释这部分代码,"背景" .equals(属性)?为什么它使用双引号作为背景?

1 个答案:

答案 0 :(得分:0)

"背景"是一个字符串 - 它正在测试property的值是否等于字符串" background"。