Results 1 to 1 of 1
Thread: Simple Table Example
-
Simple Table Example
Java Code:import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.FillLayout; 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 TableShellExample { Display d; Shell s; TableShellExample() { d = new Display(); s = new Shell(d); s.setSize(250, 200); s.setText("A Table Shell Example"); s.setLayout(new FillLayout()); Table t = new Table(s, SWT.BORDER); TableColumn tc1 = new TableColumn(t, SWT.CENTER); TableColumn tc2 = new TableColumn(t, SWT.CENTER); TableColumn tc3 = new TableColumn(t, SWT.CENTER); tc1.setText("First Name"); tc2.setText("Last Name"); tc3.setText("Address"); tc1.setWidth(70); tc2.setWidth(70); tc3.setWidth(80); t.setHeaderVisible(true); TableItem item1 = new TableItem(t, SWT.NONE); item1.setText(new String[] { "Tim", "Hatton", "Kentucky" }); TableItem item2 = new TableItem(t, SWT.NONE); item2.setText(new String[] { "Caitlyn", "Warner", "Ohio" }); TableItem item3 = new TableItem(t, SWT.NONE); item3.setText(new String[] { "Reese", "Miller", "Ohio" }); s.open(); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); } public static void main(String[] argv) { new TableShellExample(); } }"The sole cause of man’s unhappiness is that he does not know how to stay quietly in his room." - Blaise Pascal
Similar Threads
-
Help with a very simple method for a very simple beginner.
By cakeman in forum New To JavaReplies: 2Last Post: 05-04-2008, 05:27 PM -
Hash Table help
By rhm54 in forum New To JavaReplies: 0Last Post: 02-08-2008, 01:25 AM -
Inserting into a table (Example)
By Java Tip in forum Java TipReplies: 0Last Post: 02-06-2008, 09:25 AM -
regarding to creating table.....
By daredavil82 in forum New To JavaReplies: 0Last Post: 11-18-2007, 04:55 AM -
Table Help
By CoOlbOyCoOl in forum NetBeansReplies: 1Last Post: 05-06-2007, 04:19 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks