Results 1 to 1 of 1
Thread: Single and Multi Selection Lists
-
Single and Multi Selection Lists
Java Code:import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Shell; public class SingleMultiLists { Display display = new Display(); Shell shell = new Shell(display); public SingleMultiLists() { init(); GridLayout gridLayout = new GridLayout(2, true); shell.setLayout(gridLayout); (new Label(shell, SWT.NULL)).setText("SINGLE"); (new Label(shell, SWT.NULL)).setText("MULTI"); List singleSelectList = new List(shell, SWT.BORDER); List mutliSelectList = new List(shell, SWT.MULTI | SWT.BORDER); String[] items = new String[]{"Item 1", "Item 2", "Item 3", "Item 4"}; for(int i=0; i<items.length; i++) { singleSelectList.add(items[i]); mutliSelectList.add(items[i]); } shell.pack(); shell.open(); //textUser.forceFocus(); // Set up the event loop. while (!shell.isDisposed()) { if (!display.readAndDispatch()) { // If no more entries in event queue display.sleep(); } } display.dispose(); } private void init() { } public static void main(String[] args) { new SingleMultiLists(); } }"The sole cause of man’s unhappiness is that he does not know how to stay quietly in his room." - Blaise Pascal
Similar Threads
-
Compiling a single class
By ROSOBORONEXPORTCORP in forum New To JavaReplies: 2Last Post: 01-28-2008, 12:27 PM -
2 dimensional Lists
By gapper in forum New To JavaReplies: 4Last Post: 01-20-2008, 09:01 AM -
Tudu Lists 2.1
By JavaBean in forum Java SoftwareReplies: 0Last Post: 08-10-2007, 04:39 PM -
convert a lot of images into a single one
By leonard in forum New To JavaReplies: 1Last Post: 08-06-2007, 04:47 PM -
Tudu Lists 2.0
By JavaBean in forum Java SoftwareReplies: 0Last Post: 07-11-2007, 03:32 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks