Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » missing first column of a table(Show table with SetData event - missing first column)
missing first column of a table [message #499859] Tue, 24 November 2009 12:10 Go to next message
Stella Levin is currently offline Stella LevinFriend
Messages: 89
Registered: July 2009
Member
Hi, I create table like in the snippet below and the first column of the table is missing. Any suggestions will be appreciated. Thanks.
import org.eclipse.swt.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

/**
 * Displays a table
 */
public class TableTest {
	private boolean isPacked = false;
	Table table = null;
	
  public static void main(String[] args) {
    new TableTest().run();
  }

  public void run() {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    table = new Table(shell, SWT.BORDER | SWT.SINGLE | SWT.VIRTUAL);
    for (int i = 0; i < 5; i++) {
      TableColumn column = new TableColumn(table, SWT.NONE);
      column.setText("Column" + Integer.toString(i));
    }
	table.setHeaderVisible(true);
	table.setLinesVisible(true);
	table.setItemCount(10);
	table.addListener(SWT.SetData, new Listener () {
	      public void handleEvent (Event event) {
	          TableItem item = (TableItem) event.item;
	          int index = table.indexOf(item);
	          for (int j = 0; j < 5; j++) {
	              item.setText(j, "(" + index + "," + j + ")");
	          }
	          if (! isPacked) {
	        	  isPacked = true;
	        	  for (int i =0; i < table.getColumnCount(); i++) {
	        		  System.out.println("Pack column " + i);
	        		  table.getColumn(i).pack();
	        	  }
	          }
	      }
	  }); 
	
    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    display.dispose();
  }
}
Re: missing first column of a table [message #499944 is a reply to message #499859] Tue, 24 November 2009 14:53 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Columns 0-4 all show when I run your snippet on Windows 2000. Which
platform and swt version are you using?

Grant


"Stella" <stella_levin2003@yahoo.com> wrote in message
news:hegifa$56d$1@build.eclipse.org...
> Hi, I create table like in the snippet below and the first column of the
table is missing. Any suggestions will be appreciated. Thanks.
>
> import org.eclipse.swt.*;
> import org.eclipse.swt.layout.*;
> import org.eclipse.swt.widgets.*;
>
> /**
> * Displays a table
> */
> public class TableTest {
> private boolean isPacked = false;
> Table table = null;
>
> public static void main(String[] args) {
> new TableTest().run();
> }
>
> public void run() {
> Display display = new Display();
> Shell shell = new Shell(display);
> shell.setLayout(new FillLayout());
> table = new Table(shell, SWT.BORDER | SWT.SINGLE | SWT.VIRTUAL);
> for (int i = 0; i < 5; i++) {
> TableColumn column = new TableColumn(table, SWT.NONE);
> column.setText("Column" + Integer.toString(i));
> }
> table.setHeaderVisible(true);
> table.setLinesVisible(true);
> table.setItemCount(10);
> table.addListener(SWT.SetData, new Listener () {
> public void handleEvent (Event event) {
> TableItem item = (TableItem) event.item;
> int index = table.indexOf(item);
> for (int j = 0; j < 5; j++) {
> item.setText(j, "(" + index + "," + j + ")");
> }
> if (! isPacked) {
> isPacked = true;
> for (int i =0; i < table.getColumnCount(); i++) {
> System.out.println("Pack column " + i);
> table.getColumn(i).pack();
> }
> }
> }
> });
>
> shell.pack();
> shell.open();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch()) {
> display.sleep();
> }
> }
> display.dispose();
> }
> }
>
Re: missing first column of a table [message #499950 is a reply to message #499859] Tue, 24 November 2009 15:10 Go to previous messageGo to next message
Stella Levin is currently offline Stella LevinFriend
Messages: 89
Registered: July 2009
Member
I run on GNU/Linux x86_64. swt_3.4.1.v3449c.
Thanks, Stella
Re: missing first column of a table [message #500138 is a reply to message #499950] Wed, 25 November 2009 07:51 Go to previous messageGo to next message
Praveen  is currently offline Praveen Friend
Messages: 86
Registered: July 2009
Member
Stella wrote:
> I run on GNU/Linux x86_64. swt_3.4.1.v3449c.
> Thanks, Stella
I've verified that this problem is reproducible on Linux and opened Bug
296085 for addressing this issue.
Re: missing first column of a table [message #500229 is a reply to message #500138] Wed, 25 November 2009 13:01 Go to previous message
Stella Levin is currently offline Stella LevinFriend
Messages: 89
Registered: July 2009
Member
Thanks a lot for responce. Stella
Previous Topic:How to show another window when login button clicked?
Next Topic:HP-UX problem : unsatisfied link error
Goto Forum:
  


Current Time: Thu Apr 25 14:49:27 GMT 2024

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

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

Back to the top