Results 1 to 1 of 1
Thread: Displaying a table in SWT
-
Displaying a table in SWT
Java Code:import org.eclipse.swt.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; /** * Displays a table */ public class TableTest { 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 table = new Table(shell, SWT.MULTI | SWT.FULL_SELECTION); for (int i = 0; i < 5; i++) { TableColumn column = new TableColumn(table, SWT.NONE); } for (int i = 0; i < 10; i++) { TableItem item = new TableItem(table, SWT.NONE); for (int j = 0; j < 5; j++) { item.setText(j, "Row " + i + ", Column " + j); } } for (int i = 0, n = table.getColumnCount(); i < n; i++) { table.getColumn(i).pack(); } shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } }"The sole cause of man’s unhappiness is that he does not know how to stay quietly in his room." - Blaise Pascal
Similar Threads
-
No output displaying
By Rgfirefly24 in forum New To JavaReplies: 6Last Post: 04-27-2008, 08:37 PM -
problem with displaying result..
By SCS17 in forum New To JavaReplies: 4Last Post: 04-23-2008, 11:19 AM -
displaying string
By jamborta in forum AWT / SwingReplies: 6Last Post: 01-23-2008, 07:15 PM -
Displaying charts in a jsp
By Priyanka in forum Java ServletReplies: 1Last Post: 11-16-2007, 10:59 AM -
Images not displaying in JSP in IE7
By chadscc in forum Advanced JavaReplies: 0Last Post: 11-13-2007, 03:24 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks