package com.snbc.Swt;
import java.text.SimpleDateFormat;
public class ToolBar extends Composite {
public Label lblTime;
private Label lblRollMessage;
private Display display;
/**
* Create the composite.
*
* @param parent
* @param style
*/
public ToolBar(Composite parent, int style, Display disp) {
super(parent, style);
this.display = disp;
setLayout(new FillLayout(SWT.HORIZONTAL));
Label label_1 = new Label(this, SWT.BORDER);
label_1.setText(" :");
lblRollMessage = new Label(this, SWT.BORDER);
lblRollMessage.setText(" , ");
Label label_2 = new Label(this, SWT.BORDER);
label_2.setText(" :");
lblTime = new Label(this, SWT.BORDER);
lblTime.setText("x");
//
final Runnable timer = new Runnable() {
public void run() {
if (display.isDisposed()) {
return;
}
Date dt = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
lblTime.setText(sdf.format(dt));
display.timerExec(500, this);
}
};
//
display.timerExec(500, timer);
}
@Override
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
}
}