best way to create a tablefolder with lots of button [message #509049] |
Thu, 21 January 2010 09:43 |
No real name Messages: 64 Registered: July 2009 |
Member |
|
|
hi, I have problems to create a tablefolder with lots of element (more than 1000).
there is my code (that I simplified)
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.TableEditor;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
public class testframe {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
Table table = new Table(shell, SWT.BORDER | SWT.V_SCROLL);
table.setLinesVisible(true);
table.setHeaderVisible(true);
table.setBounds(0, 0, 800, 500);
for (int i = 1; i < 11; i++) {
TableColumn tc = new TableColumn(table, SWT.NONE);
tc.setText("col :" + i);
tc.setWidth(100);
}
for (int line = 0; line < 10000; line++) {
System.out.println("line" + line);
TableItem NCurItem = new TableItem(table, SWT.NONE);
for (int col = 0; col < 10; col++) {
TableEditor editor = new TableEditor(table);
Button button = new Button(table, SWT.CHECK | SWT.CENTER);
button.pack();
editor.minimumWidth = button.getSize().x;
editor.horizontalAlignment = SWT.CENTER;
editor.setEditor(button, NCurItem, col);
NCurItem.setData(Integer.toString(col), editor);
}
}
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
I have 2 problem.
first, I have a no more handles problem .
is there a better way to create button (text, spinner)without create a table editor for each column. (but with a listener of cause).
second thing, if I put only 100 lines (replacing 10000).
I have enough handles, but it's very slow to use and it take lot of time to si it.
is there any way to pass trough these problem (slow and no more handles ?) thank you
a++
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03803 seconds