|
|
Re: Drawing a border around a Combo [message #641218 is a reply to message #641105] |
Wed, 24 November 2010 09:38  |
Eclipse User |
|
|
|
This looks like a bug, I don't see why the lines you've pasted would result
in multiple borders being drawn.
The easiest workaround you can try is to give the Combo an additional
Composite parent and draw the border on it. The following snippet
demonstrates this:
public static void main(String[] args) {
final Display display = new Display();
Shell shell = new Shell(display);
shell.setBounds(200, 200, 200, 200);
shell.setLayout(new GridLayout());
final Composite composite = new Composite(shell, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginWidth = layout.marginHeight = 1;
composite.setLayout(layout);
composite.addPaintListener(new PaintListener() {
public void paintControl(final PaintEvent e) {
Rectangle bounds = composite.getBounds();
e.gc.setAntialias(SWT.ON);
e.gc.setForeground(display.getSystemColor(SWT.COLOR_RED));
e.gc.drawRectangle(0, 0, bounds.width - 1, bounds.height - 1);
}
});
final Combo combo = new Combo(composite, SWT.NONE);
combo.add("car");
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
Grant
"Behnil" <behnil@centrum.cz> wrote in message
news:icilvr$bno$1@news.eclipse.org...
> Nobody knows??
|
|
|
Powered by
FUDForum. Page generated in 0.07408 seconds