Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Noob question

Hi guys im brand new to SWT and i have what is proberly a noob question for
you.

Im trying to make an application that, to start with, only shows a couple of
buttons. 
When the user presses one of these buttons, the program should then show
something completely different in the window.
My question is: 
What is the easiest way to do this? Do i close the current shell and make a
new one?

Here is what i have so far:
public class Prototype {

	public static void main(String [] args){
		Display display = new Display();
		Shell shell = new Shell(display);
		
		shell.setSize(800,600);
		
		GridLayout gridLayout = new GridLayout(2,true);

		shell.setLayout(gridLayout);
		
		Button nySag = new Button(shell,SWT.PUSH);
		nySag.setSize(100, 60);
		nySag.setText("Ny Sag");
		nySag.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, true, 1,
1));
		nySag.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				// ???????????
			}
		});
		
		
		Button liste = new Button(shell,SWT.PUSH);
		liste.setSize(100, 60);
		liste.setText("Liste over all sagkyndige");
		liste.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1));
		
		
		shell.open();	
		while(!shell.isDisposed()){
			if(!display.readAndDispatch())
				display.sleep();
			}
		display.dispose();
	}
}

Please let me know if you need anymore info.

Hope you can point me in the right dirrection.

Regards
Tilds
-- 
View this message in context: http://www.nabble.com/Noob-question-tp22309189p22309189.html
Sent from the Eclipse Platform - swt mailing list archive at Nabble.com.



Back to the top