# Design Time Detection

**URL:** <https://forum.inductiveautomation.com/t/design-time-detection/11228>\
**Category:** 3rd Party Modules\
**Created:** [February 17, 2016, 6:10pm UTC](https://forum.inductiveautomation.com/t/design-time-detection/11228 "2016-02-17T18:10:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cody.tamaki](https://avatars.discourse-cdn.com/v4/letter/c/b487fb/32.png) [@cody.tamaki](https://forum.inductiveautomation.com/u/cody.tamaki)\
**Post date:** [February 17, 2016, 6:10pm UTC](https://forum.inductiveautomation.com/t/design-time-detection/11228/1 "2016-02-17T18:10:51Z")

</div>

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](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?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 17, 2016, 10:03pm UTC](https://forum.inductiveautomation.com/t/design-time-detection/11228/2 "2016-02-17T22:03:03Z")

</div>

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]
```

---

<div class="post-metadata">

**Author:** ![cody.tamaki](https://avatars.discourse-cdn.com/v4/letter/c/b487fb/32.png) [@cody.tamaki](https://forum.inductiveautomation.com/u/cody.tamaki)\
**Post date:** [February 18, 2016, 2:07am UTC](https://forum.inductiveautomation.com/t/design-time-detection/11228/3 "2016-02-18T02:07:56Z")

</div>

Thanks Phil!
