Skip to content

When in the designer, if(Beans.isDesignTime() == true) is ignored, while if(Beans.isDesignTime()) is honored #1390

@ForceRs

Description

@ForceRs

I'm running WindowBuilder 1.22.0.202511270930

When in the design tab, if(Beans.isDesignTime() == true) is ignored, while if(Beans.isDesignTime() is honored.
Why is this?
Here's a simple test case:

import java.awt.BorderLayout;
import java.beans.Beans;

import javax.swing.JLabel;
import javax.swing.JPanel;

public class WbpIssue extends JPanel {
	private static final long serialVersionUID = 1L;
	private JLabel lbCenter;
	private JLabel lbNorth;
	public WbpIssue() {
		setLayout(new BorderLayout(0, 0));
		if(Beans.isDesignTime() == true) {
			add(getLbNorth(), BorderLayout.NORTH);
		}
		if(Beans.isDesignTime()) {
			add(getLbCenter(), BorderLayout.CENTER);			
		}
	}
	private JLabel getLbNorth() {
		if (lbNorth == null) {
			lbNorth = new JLabel("North");
		}
		return lbNorth;
	}
	private JLabel getLbCenter() {
		if (lbCenter == null) {
			lbCenter = new JLabel("Center");
		}
		return lbCenter;
	}
}

When you load this into the editor's Design tab, the only label displayed is "Center". The "North" label is not shown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions