summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/gui/GuiManager.java
blob: 41d5c7110e43cad86fb43d6c8a66c11269e4c048 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package gui;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public abstract class GuiManager {

	private static Display _display;
	private static Shell _mainShell;
	private static Shell _containerShell;

	public static void initGui() {
		// init display, shell
		_display = new Display();
		_mainShell = new Shell(_display);

		// add static gui elements
		_containerShell = _mainShell;

		// pack (aka size widgets) and open
		_mainShell.pack();
		_mainShell.open();

		// main loop
		while (!_mainShell.isDisposed()) {
			if (!_display.readAndDispatch())
				_display.sleep();
		}
		_display.dispose();
	}
}