Design Time Detection

Following on from this post (My account isn’t allowed to reply on that forum):
https://inductiveautomation.com/forum/viewtopic.php?f=88&t=11710

How do you guys recommend we listen for design time/preview mode? I’m using Beans.isDesignTime() to detect preview mode but if there isn’t an event should I code a timed task into the component that constantly checks this?

I would just check it in the component’s paint method(s). Like the following for a trial expiration notice (overlay):[code]
/* Properties used when Trial Mode expires */
private static TextBlock exptxt = TextUtilities.createTextBlock(“Trial Expired”, new Font(“Dialog”, Font.BOLD, 16), Color.BLACK);
private static Stroke expstr = new BasicStroke(3.0f);

@Override
public void paintComponent(Graphics _g) {
	super.paintComponent(_g);
	if (ClientHook.getExpired()) {
		Graphics2D g2  = (Graphics2D)_g;
		Paint xPaint   = g2.getPaint();
		Stroke xStroke = g2.getStroke();
		Rectangle2D da = getScreenDataArea();
		Shape txtshp   = exptxt.calculateBounds(g2, (float)da.getCenterX(), (float)da.getCenterY(), TextBlockAnchor.CENTER, 0, 0, 0);
		Rectangle2D outline = new RectangleInsets(3,3,3,3).createOutsetRectangle(txtshp.getBounds2D());
		g2.setPaint(Color.LIGHT_GRAY);
		g2.fill(outline);
		g2.setPaint(Color.BLACK);
		g2.setStroke(expstr);
		g2.draw(outline);
		exptxt.draw(g2, (float)da.getCenterX(), (float)da.getCenterY(), TextBlockAnchor.CENTER);
		g2.setPaint(xPaint);
		g2.setStroke(xStroke);
	}
}[/code]

Thanks Phil!