Reputation: 661
i can't seem to find online help on how to add different type of borders in Eclipse RCP. I know Swing has BevelBorder which can be achieved using BorderFactory. Any swt equivalence?
Upvotes: 0
Views: 350
Reputation: 2352
Please use this method for Bevel Border
private void drawBorders(GC gc, int x, int y, int w, int h) {
final Display disp = getDisplay();
final Color topleft = disp.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
final Color bottomright = disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
if (topleft != null && bottomright != null) {
gc.setLineWidth(1);
gc.setForeground(bottomright);
gc.drawLine(x + w, y, x + w, y + h);
gc.drawLine(x, y + h, x + w, y + h);
gc.setForeground(topleft);
gc.drawLine(x, y, x + w - 1, y);
gc.drawLine(x, y, x, y + h - 1);
}
}
Upvotes: 1
Reputation: 1050
Try this styles: SWT.SHADOW_IN, SWT.SHADOW_OUT, SWT.SHADOW_ETCHED_IN, SWT.SHADOW_ETCHED_OUT
Upvotes: 3