TableColumn setAlignment not working for images on Windows? [message #653706] |
Thu, 10 February 2011 19:06 |
David Whiteman Messages: 5 Registered: July 2009 Location: Research Triangle Park, N... |
Junior Member |
|
|
I am running this on Windows XP, and setAlignment seems to be completely ignored for columns with images. The JavaDoc suggests that it should work for text and images. Is this a known defect, or working as designed? Note that this is not the first column in the table, which I already knew was a known defect.
Here's my testcase, which is a modified version of one of the SWT snippets:
package org.eclipse.swt.snippets;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
public class Snippet297 {
public static void main(String[] args) {
Display display = new Display();
Image images[] = new Image[] {
display.getSystemImage(SWT.ICON_INFORMATION),
display.getSystemImage(SWT.ICON_ERROR),
display.getSystemImage(SWT.ICON_QUESTION),
display.getSystemImage(SWT.ICON_WARNING) };
String[] titles = { "Information", "Error", "Question", "Warning" };
String[] questions = { "who?", "what?", "where?", "when?", "why?" };
Shell shell = new Shell(display);
shell.setLayout(new GridLayout());
Table table = new Table(shell, SWT.MULTI | SWT.BORDER
| SWT.FULL_SELECTION);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
data.heightHint = 200;
table.setLayoutData(data);
table.setLinesVisible(true);
table.setHeaderVisible(true);
for (int i = 0; i < titles.length; i++) {
TableColumn column = new TableColumn(table, SWT.CENTER);
column.setText(titles[i]);
column.setImage(images[i]);
}
int count = 128;
for (int i = 0; i < count; i++) {
TableItem item = new TableItem(table, SWT.NONE);
item.setText(0, "some info");
item.setText(1, "error #" + i);
item.setText(2, questions[i % questions.length]);
// item.setText (3, "look out!");
item.setImage(3, images[0]);
}
for (int i = 0; i < titles.length; i++) {
table.getColumn(i).pack();
}
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
Thanks in advance,
David Whiteman
---
David Whiteman
Cisco Systems
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03262 seconds