Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » TableColumn setAlignment not working for images on Windows?
icon5.gif  TableColumn setAlignment not working for images on Windows? [message #653706] Thu, 10 February 2011 19:06 Go to next message
David Whiteman is currently offline David WhitemanFriend
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
Re: TableColumn setAlignment not working for images on Windows? [message #653817 is a reply to message #653706] Fri, 11 February 2011 12:01 Go to previous messageGo to next message
Lakshmi P ShanmugamFriend
Messages: 279
Registered: July 2009
Location: India
Senior Member
Please see this bug --> https://bugs.eclipse.org/bugs/show_bug.cgi?id=26045 and for possible workaround please see --> https://bugs.eclipse.org/bugs/show_bug.cgi?id=226715

Lakshmi P Shanmugam
Re: TableColumn setAlignment not working for images on Windows? [message #653834 is a reply to message #653817] Fri, 11 February 2011 13:36 Go to previous message
David Whiteman is currently offline David WhitemanFriend
Messages: 5
Registered: July 2009
Location: Research Triangle Park, N...
Junior Member
Thank you for the links! I am not sure how I missed those two bugs. I put in a request for better javadocs around this issue.

---
David Whiteman
Cisco Systems
Previous Topic:Transform.rotate(45)
Next Topic:cannot build swt 3721 jni libs with VS 2010
Goto Forum:
  


Current Time: Thu Apr 25 03:46:20 GMT 2024

Powered by FUDForum. Page generated in 0.03280 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top