In general, SWT Widgets does not provide any functionality to add the colored border around it. But this can be done by using a simple trick. Here is the simple example of the Text Widgets to explain the approach.

To add colored border around the Text a Rectangle can be drawn around the Text by using PaintListener().

Implementation Code:

 1. private void initialize() {
2.   GridData g=new GridData();
3.  g.grabExcessHorizontalSpace=true;
4.  g.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
5.  Label label=new Label(this,SWT.NONE);
6.  label.setText("Bordered Text");
7.  text = new Text(this, SWT.NONE);
8.  text.setBounds(new org.eclipse.swt.graphics.Rectangle(92,40,84,28));
9.  text.setLayoutData(g);
10.  addPaintListener(new PaintListener() {
11.    public void paintControl(PaintEvent e) {
12.      GC gc=e.gc;
13.      Color red=new Color(null,255,0,0);
14.      gc.setBackground(red);
15.      Rectangle rect=text.getBounds();
16.      Rectangle rect1 = new Rectangle(rText.x-1, rText.y-1, 
17.        rText.width+2, rText.height+2);
18.
19.      gc.fillRectangle(rect1);
20.      addControlListener(new ControlAdapter() {
21.        public void controlResized(ControlEvent e) {
22.          super.controlResized(e);        21.        }
23.      });
24.    }
25  });
26.}

In the Above code first SWT.Text is added on the composite (In step 7-9), Then Draw the Border around the Text. For this first the boundary of the text is calculated in the form of rectangle (In step 15) then a rectangle with the desired color is drawn to the boundary of the Text (In step 16-19). ControlListener() can be added so that when the size of the Widget change, size of the surrounding rectangle will also change.