Thanks Josh and Daniel - both methods have worked. I have gone with checking if the object is null or not like so...
public class SomePanel extends Panel { public SomePanel(String id) { super(id); if ( data == null ) { return; } Label label = new Label("someLabel", String.valueOf(data.getId())); add(label); } } I have decided to do this because I am not sure how I can format a date without doing this... SimpleDateFormat dateFormat = new SimpleDateFormat( "dd/MM/yyyy" ); Label dateLabel = new Label( "date", dateFormat.format( data.getDate( ) ) ); Thanks.