# SWT und Model View Controller?



## Mork0075 (18. Sep 2004)

Halli Hallo

Ich möchte meiner SWT GUI mehr Struktur verpassen und deshalb schön und sauber nach dem MVC Pattern trennen. Hab dazu die Referenzen der GUI Elemente an eine Controller Klasse per Konstruktor weitergegeben. Aber irgendwie hab ich das Gefühl das SWT und MVC nicht so recht zusammen passen. Ich kann komischerweise aus der Controller Klasse keine GUI Elemente in der GUi Klasse ändern. Was mache ich falsch bzw was ist zu beachten?


----------



## foobar (18. Sep 2004)

Code ?????


----------



## Mork0075 (18. Sep 2004)

```
public class Main {
	
	public static void main(String[] args) {
		MainGUI window = new MainGUI();
		window.open();
		
	}

}
```


```
public class MainGUI {

	private Button button_reset;
	private Button button_speichern;
	private Button button_berchnen;
	
	private Label label_analyse_gesamt_result;
	private Label label_analyse_rechenweg_result;
	private Label label_analyse_klassenarbeiten_result;
	private Label label_analyse_tests_result;
	private Label label_analyse_datum_result;
	
	private Button button_ka_aktiv_3;
	private Text text_ka_note_3;
	private Combo combo_ka_wertigkeit_3;
	private Text text_ka_bemerkung_3;
	
	private Button button_ka_aktiv_2;
	private Text text_ka_note_2;
	private Combo combo_ka_wertigkeit_2;
	private Text text_ka_bemerkung_2;
	
	private Button button_ka_aktiv_1;
	private Text text_ka_note_1;
	private Combo combo_ka_wertigkeit_1;
	private Text text_ka_bemerkung_1;
	
	private Button button_lk_aktiv_15;
	private Text text_lk_note_15;
	private Combo combo_lk_wertigkeit_15;
	private Text text_lk_bemerkung_15;
	
	private Button button_lk_aktiv_14;
	private Text text_lk_note_14;
	private Combo combo_lk_wertigkeit_14;
	private Text text_lk_bemerkung_14;
	
	private Button button_lk_aktiv_13;
	private Text text_lk_note_13;
	private Combo combo_lk_wertigkeit_13;
	private Text text_lk_bemerkung_13;
	
	private Button button_lk_aktiv_12;
	private Text text_lk_note_12;
	private Combo combo_lk_wertigkeit_12;
	private Text text_lk_bemerkung_12;
	
	private Button button_lk_aktiv_11;
	private Text text_lk_note_11;
	private Combo combo_lk_wertigkeit_11;
	private Text text_lk_bemerkung_11;
	
	private Button button_lk_aktiv_10;
	private Text text_lk_note_10;
	private Combo combo_lk_wertigkeit_10;
	private Text text_lk_bemerkung_10;
	
	private Button button_lk_aktiv_9;
	private Text text_lk_note_9;
	private Combo combo_lk_wertigkeit_9;
	private Text text_lk_bemerkung_9;
	
	private Button button_lk_aktiv_8;
	private Text text_lk_note_8;
	private Combo combo_lk_wertigkeit_8;
	private Text text_lk_bemerkung_8;
	
	private Button button_lk_aktiv_7;
	private Text text_lk_note_7;
	private Combo combo_lk_wertigkeit_7;
	private Text text_lk_bemerkung_7;
	
	private Button button_lk_aktiv_6;
	private Text text_lk_note_6;
	private Combo combo_lk_wertigkeit_6;
	private Text text_lk_bemerkung_6;
	
	private Button button_lk_aktiv_5;
	private Text text_lk_note_5;
	private Combo combo_lk_wertigkeit_5;
	private Text text_lk_bemerkung_5;
	
	private Button button_lk_aktiv_4;
	private Text text_lk_note_4;
	private Combo combo_lk_wertigkeit_4;
	private Text text_lk_bemerkung_4;
	
	private Button button_lk_aktiv_3;
	private Text text_lk_note_3;
	private Combo combo_lk_wertigkeit_3;
	private Text text_lk_bemerkung_3;
	
	private Button button_lk_aktiv_2;
	private Text text_lk_note_2;
	private Combo combo_lk_wertigkeit_2;
	private Text text_lk_bemerkung_2;
	
	private Text text_lk_bemerkung_1;
	private Combo combo_lk_wertigkeit_1;
	private Text text_lk_note_1;
	private Button button_lk_aktiv_1;
	
	

	public void open() {
		final Display display = Display.getDefault();
		final Shell shell = new Shell();
		
		shell.setSize(800, 600);
		shell.setText("NotenTool - Behalte den Überblick!");
		
		Menu menu = new Menu(shell, SWT.BAR);
	      shell.setMenuBar(menu);
		
	      MenuItem datei = new MenuItem(menu, SWT.CASCADE);
	      datei.addSelectionListener(new SelectionAdapter() {
	      	public void widgetSelected(SelectionEvent e) {
	      		
	      		
	      	}
	      });
	      datei.setText("Datei");
	      
	      MenuItem edit = new MenuItem(menu, SWT.CASCADE);
	      edit.addSelectionListener(new SelectionAdapter() {
	      	public void widgetSelected(SelectionEvent e) {
	      		
	      		
	      	}
	      });
	      edit.setText("Bearbeiten");
	      
	      MenuItem about = new MenuItem(menu, SWT.CASCADE);
	      about.addSelectionListener(new SelectionAdapter() {
	      	public void widgetSelected(SelectionEvent e) {
	      		
	      		
	      	}
	      });
	      about.setText("About");

		final Group group = new Group(shell, SWT.NONE);
		group.setText("Leistungskontrollen");
		group.setBounds(10, 10, 375, 535);

		final Label label_lk_aktiv = new Label(group, SWT.NONE);
		label_lk_aktiv.setBounds(20, 26, 30, 20);
		label_lk_aktiv.setText("Aktiv");

		final Label label_lk_note = new Label(group, SWT.NONE);
		label_lk_note.setBounds(76, 26, 30, 20);
		label_lk_note.setText("Note");

		final Label label_lk_wertigkeit = new Label(group, SWT.NONE);
		label_lk_wertigkeit.setBounds(144, 26, 60, 20);
		label_lk_wertigkeit.setText("Wertigkeit");

		final Label label_lk_bemerkung = new Label(group, SWT.NONE);
		label_lk_bemerkung.setBounds(227, 26, 60, 20);
		label_lk_bemerkung.setText("Bemerkung");

		//LK1
		button_lk_aktiv_1 = new Button(group, SWT.CHECK);
		button_lk_aktiv_1.setBounds(24, 47, 15, 25);
		button_lk_aktiv_1.setText("check button");

		text_lk_note_1 = new Text(group, SWT.BORDER);
		text_lk_note_1.setBounds(73, 49, 45, 20);

		combo_lk_wertigkeit_1 = new Combo(group, SWT.NONE);
		combo_lk_wertigkeit_1.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_lk_wertigkeit_1.select(3);
		combo_lk_wertigkeit_1.setBounds(142, 49, 65, 20);

		text_lk_bemerkung_1 = new Text(group, SWT.BORDER);
		text_lk_bemerkung_1.setBounds(225, 49, 135, 20);
		
		//LK2
		button_lk_aktiv_2 = new Button(group, SWT.CHECK);
		button_lk_aktiv_2.setBounds(24, 79, 15, 25);
		button_lk_aktiv_2.setText("check button");

		text_lk_note_2 = new Text(group, SWT.BORDER);
		text_lk_note_2.setBounds(73, 81, 45, 20);

		combo_lk_wertigkeit_2 = new Combo(group, SWT.NONE);
		combo_lk_wertigkeit_2.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_lk_wertigkeit_2.setBounds(142, 81, 65, 20);

		text_lk_bemerkung_2 = new Text(group, SWT.BORDER);
		text_lk_bemerkung_2.setBounds(225, 81, 135, 20);
		
		//LK3
		button_lk_aktiv_3 = new Button(group, SWT.CHECK);
		button_lk_aktiv_3.setBounds(24, 111, 15, 25);
		button_lk_aktiv_3.setText("check button");

		text_lk_note_3 = new Text(group, SWT.BORDER);
		text_lk_note_3.setBounds(73, 113, 45, 20);

		combo_lk_wertigkeit_3 = new Combo(group, SWT.NONE);
		combo_lk_wertigkeit_3.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_lk_wertigkeit_3.setBounds(142, 113, 65, 20);

		text_lk_bemerkung_3 = new Text(group, SWT.BORDER);
		text_lk_bemerkung_3.setBounds(225, 113, 135, 20);
		
		//LK4
		button_lk_aktiv_4 = new Button(group, SWT.CHECK);
		button_lk_aktiv_4.setBounds(24, 143, 15, 25);
		button_lk_aktiv_4.setText("check button");

		text_lk_note_4 = new Text(group, SWT.BORDER);
		text_lk_note_4.setBounds(73, 145, 45, 20);

		combo_lk_wertigkeit_4 = new Combo(group, SWT.NONE);
		combo_lk_wertigkeit_4.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_lk_wertigkeit_4.setBounds(142, 145, 65, 20);

		text_lk_bemerkung_4 = new Text(group, SWT.BORDER);
		text_lk_bemerkung_4.setBounds(225, 145, 135, 20);
		
		//LK5
		button_lk_aktiv_5 = new Button(group, SWT.CHECK);
		button_lk_aktiv_5.setBounds(24, 175, 15, 25);
		button_lk_aktiv_5.setText("check button");

		text_lk_note_5 = new Text(group, SWT.BORDER);
		text_lk_note_5.setBounds(73, 177, 45, 20);

		combo_lk_wertigkeit_5 = new Combo(group, SWT.NONE);
		combo_lk_wertigkeit_5.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_lk_wertigkeit_5.setBounds(142, 177, 65, 20);

		text_lk_bemerkung_5 = new Text(group, SWT.BORDER);
		text_lk_bemerkung_5.setBounds(225, 177, 135, 20);
		
		//LK6
		button_lk_aktiv_6 = new Button(group, SWT.CHECK);
		button_lk_aktiv_6.setBounds(24, 207, 15, 25);
		button_lk_aktiv_6.setText("check button");

		text_lk_note_6 = new Text(group, SWT.BORDER);
		text_lk_note_6.setBounds(73, 209, 45, 20);

		combo_lk_wertigkeit_6 = new Combo(group, SWT.NONE);
		combo_lk_wertigkeit_6.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_lk_wertigkeit_6.setBounds(142, 209, 65, 20);

		text_lk_bemerkung_6 = new Text(group, SWT.BORDER);
		text_lk_bemerkung_6.setBounds(225, 209, 135, 20);
		
		//LK7
		button_lk_aktiv_7 = new Button(group, SWT.CHECK);
		button_lk_aktiv_7.setBounds(24, 239, 15, 25);
		button_lk_aktiv_7.setText("check button");

		text_lk_note_7 = new Text(group, SWT.BORDER);
		text_lk_note_7.setBounds(73, 241, 45, 20);

		combo_lk_wertigkeit_7 = new Combo(group, SWT.NONE);
		combo_lk_wertigkeit_7.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_lk_wertigkeit_7.setBounds(142, 241, 65, 20);

		text_lk_bemerkung_7 = new Text(group, SWT.BORDER);
		text_lk_bemerkung_7.setBounds(225, 241, 135, 20);
		
		//LK8
		button_lk_aktiv_8 = new Button(group, SWT.CHECK);
		button_lk_aktiv_8.setBounds(24, 271, 15, 25);
		button_lk_aktiv_8.setText("check button");

		text_lk_note_8 = new Text(group, SWT.BORDER);
		text_lk_note_8.setBounds(73, 273, 45, 20);

		combo_lk_wertigkeit_8 = new Combo(group, SWT.NONE);
		combo_lk_wertigkeit_8.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_lk_wertigkeit_8.setBounds(142,273, 65, 20);

		text_lk_bemerkung_8 = new Text(group, SWT.BORDER);
		text_lk_bemerkung_8.setBounds(225, 273, 135, 20);
		
		//LK9
		button_lk_aktiv_9 = new Button(group, SWT.CHECK);
		button_lk_aktiv_9.setBounds(24, 303, 15, 25);
		button_lk_aktiv_9.setText("check button");

		text_lk_note_9 = new Text(group, SWT.BORDER);
		text_lk_note_9.setBounds(73, 305, 45, 20);

		combo_lk_wertigkeit_9 = new Combo(group, SWT.NONE);
		combo_lk_wertigkeit_9.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_lk_wertigkeit_9.setBounds(142,305, 65, 20);

		text_lk_bemerkung_9 = new Text(group, SWT.BORDER);
		text_lk_bemerkung_9.setBounds(225, 305, 135, 20);
		
		//LK10
		button_lk_aktiv_10 = new Button(group, SWT.CHECK);
		button_lk_aktiv_10.setBounds(24, 335, 15, 25);
		button_lk_aktiv_10.setText("check button");

		text_lk_note_10 = new Text(group, SWT.BORDER);
		text_lk_note_10.setBounds(73, 337, 45, 20);

		combo_lk_wertigkeit_10 = new Combo(group, SWT.NONE);
		combo_lk_wertigkeit_10.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_lk_wertigkeit_10.setBounds(142,337, 65, 20);

		text_lk_bemerkung_10 = new Text(group, SWT.BORDER);
		text_lk_bemerkung_10.setBounds(225, 337, 135, 20);
		
		//LK11
		button_lk_aktiv_11 = new Button(group, SWT.CHECK);
		button_lk_aktiv_11.setBounds(24, 367, 15, 25);
		button_lk_aktiv_11.setText("check button");

		text_lk_note_11 = new Text(group, SWT.BORDER);
		text_lk_note_11.setBounds(73, 369, 45, 20);

		combo_lk_wertigkeit_11 = new Combo(group, SWT.NONE);
		combo_lk_wertigkeit_11.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_lk_wertigkeit_11.setBounds(142,369, 65, 20);

		text_lk_bemerkung_11 = new Text(group, SWT.BORDER);
		text_lk_bemerkung_11.setBounds(225, 369, 135, 20);

		//LK12
		button_lk_aktiv_12 = new Button(group, SWT.CHECK);
		button_lk_aktiv_12.setBounds(24, 399, 15, 25);
		button_lk_aktiv_12.setText("check button");

		text_lk_note_12 = new Text(group, SWT.BORDER);
		text_lk_note_12.setBounds(73, 401, 45, 20);

		combo_lk_wertigkeit_12 = new Combo(group, SWT.NONE);
		combo_lk_wertigkeit_12.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_lk_wertigkeit_12.setBounds(142,401, 65, 20);

		text_lk_bemerkung_12 = new Text(group, SWT.BORDER);
		text_lk_bemerkung_12.setBounds(225, 401, 135, 20);
		
		//LK13
		button_lk_aktiv_13 = new Button(group, SWT.CHECK);
		button_lk_aktiv_13.setBounds(24, 431, 15, 25);
		button_lk_aktiv_13.setText("check button");

		text_lk_note_13 = new Text(group, SWT.BORDER);
		text_lk_note_13.setBounds(73, 433, 45, 20);

		combo_lk_wertigkeit_13 = new Combo(group, SWT.NONE);
		combo_lk_wertigkeit_13.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_lk_wertigkeit_13.setBounds(142,433, 65, 20);

		text_lk_bemerkung_13 = new Text(group, SWT.BORDER);
		text_lk_bemerkung_13.setBounds(225, 433, 135, 20);
		
		//LK14
		button_lk_aktiv_14 = new Button(group, SWT.CHECK);
		button_lk_aktiv_14.setBounds(24, 463, 15, 25);
		button_lk_aktiv_14.setText("check button");

		text_lk_note_14 = new Text(group, SWT.BORDER);
		text_lk_note_14.setBounds(73, 465, 45, 20);

		combo_lk_wertigkeit_14 = new Combo(group, SWT.NONE);
		combo_lk_wertigkeit_14.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_lk_wertigkeit_14.setBounds(142,465, 65, 20);

		text_lk_bemerkung_14 = new Text(group, SWT.BORDER);
		text_lk_bemerkung_14.setBounds(225, 465, 135, 20);
		
		//LK15
		button_lk_aktiv_15 = new Button(group, SWT.CHECK);
		button_lk_aktiv_15.setBounds(24, 495, 15, 25);
		button_lk_aktiv_15.setText("check button");

		text_lk_note_15 = new Text(group, SWT.BORDER);
		text_lk_note_15.setBounds(73, 497, 45, 20);

		combo_lk_wertigkeit_15 = new Combo(group, SWT.NONE);
		combo_lk_wertigkeit_15.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_lk_wertigkeit_15.setBounds(142,497, 65, 20);

		text_lk_bemerkung_15 = new Text(group, SWT.BORDER);
		text_lk_bemerkung_15.setBounds(225, 497, 135, 20);
		
		
		
		
		
		final Group group_1 = new Group(shell, SWT.NONE);
		group_1.setText("Klassenarbeiten");
		group_1.setBounds(395, 10, 385, 150);
		
		final Label label_ka_aktiv = new Label(group_1, SWT.NONE);
		label_ka_aktiv.setBounds(20, 26, 30, 20);
		label_ka_aktiv.setText("Aktiv");

		final Label label_ka_note = new Label(group_1, SWT.NONE);
		label_ka_note.setBounds(76, 26, 30, 20);
		label_ka_note.setText("Note");

		final Label label_ka_wertigkeit = new Label(group_1, SWT.NONE);
		label_ka_wertigkeit.setBounds(144, 26, 60, 20);
		label_ka_wertigkeit.setText("Wertigkeit");

		final Label label_ka_bemerkung = new Label(group_1, SWT.NONE);
		label_ka_bemerkung.setBounds(227, 26, 60, 20);
		label_ka_bemerkung.setText("Bemerkung");

		//LK1
		button_ka_aktiv_1 = new Button(group_1, SWT.CHECK);
		button_ka_aktiv_1.setBounds(24, 47, 15, 25);
		button_ka_aktiv_1.setText("check button");

		text_ka_note_1 = new Text(group_1, SWT.BORDER);
		text_ka_note_1.setBounds(73, 49, 45, 20);

		combo_ka_wertigkeit_1 = new Combo(group_1, SWT.NONE);
		combo_ka_wertigkeit_1.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_ka_wertigkeit_1.select(9);
		combo_ka_wertigkeit_1.setBounds(142, 49, 65, 20);

		text_ka_bemerkung_1 = new Text(group_1, SWT.BORDER);
		text_ka_bemerkung_1.setBounds(225, 49, 135, 20);
		
		//LK2
		button_ka_aktiv_2 = new Button(group_1, SWT.CHECK);
		button_ka_aktiv_2.setBounds(24, 79, 15, 25);
		button_ka_aktiv_2.setText("check button");

		text_ka_note_2 = new Text(group_1, SWT.BORDER);
		text_ka_note_2.setBounds(73, 81, 45, 20);

		combo_ka_wertigkeit_2 = new Combo(group_1, SWT.NONE);
		combo_ka_wertigkeit_2.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_ka_wertigkeit_2.setBounds(142, 81, 65, 20);

		text_ka_bemerkung_2 = new Text(group_1, SWT.BORDER);
		text_ka_bemerkung_2.setBounds(225, 81, 135, 20);
		
		//LK3
		button_ka_aktiv_3 = new Button(group_1, SWT.CHECK);
		button_ka_aktiv_3.setBounds(24, 111, 15, 25);
		button_ka_aktiv_3.setText("check button");

		text_ka_note_3 = new Text(group_1, SWT.BORDER);
		text_ka_note_3.setBounds(73, 113, 45, 20);

		combo_ka_wertigkeit_3 = new Combo(group_1, SWT.NONE);
		combo_ka_wertigkeit_3.setItems(new String[] { "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%" });
		combo_ka_wertigkeit_3.setBounds(142, 113, 65, 20);

		text_ka_bemerkung_3 = new Text(group_1, SWT.BORDER);
		text_ka_bemerkung_3.setBounds(225, 113, 135, 20);
		
		

		final Group group_2 = new Group(shell, SWT.NONE);
		group_2.setText("Analyse");
		group_2.setBounds(395, 165, 385, 175);

		final Label label_analyse_datum = new Label(group_2, SWT.NONE);
		label_analyse_datum.setBounds(20, 25, 40, 20);
		label_analyse_datum.setText("Datum:");

		final Label label_analyse_tests = new Label(group_2, SWT.NONE);
		label_analyse_tests.setBounds(20, 55, 105, 20);
		label_analyse_tests.setText("Durchschnitt Tests:");

		final Label label_analyse_klassenarbeiten = new Label(group_2, SWT.NONE);
		label_analyse_klassenarbeiten.setBounds(20, 85, 150, 20);
		label_analyse_klassenarbeiten.setText("Durchschnitt Klassenarbeiten:");

		final Label label_analyse_rechenweg = new Label(group_2, SWT.NONE);
		label_analyse_rechenweg.setBounds(20, 115, 105, 20);
		label_analyse_rechenweg.setText("Rechenweg Gesamt:");

		final Label label_analyse_gesamt = new Label(group_2, SWT.NONE);
		label_analyse_gesamt.setBounds(20, 145, 70, 20);
		label_analyse_gesamt.setText("Note Gesamt:");

		label_analyse_datum_result = new Label(group_2, SWT.NONE);
		label_analyse_datum_result.setBounds(65, 25, 305, 20);

		label_analyse_tests_result = new Label(group_2, SWT.NONE);
		label_analyse_tests_result.setBounds(125, 55, 250, 20);

		label_analyse_klassenarbeiten_result = new Label(group_2, SWT.NONE);
		label_analyse_klassenarbeiten_result.setBounds(170, 85, 205, 20);

		label_analyse_rechenweg_result = new Label(group_2, SWT.NONE);
		label_analyse_rechenweg_result.setBounds(125, 115, 250, 20);

		label_analyse_gesamt_result = new Label(group_2, SWT.NONE);
		label_analyse_gesamt_result.setBounds(95, 145, 280, 20);

		button_berchnen = new Button(shell, SWT.NONE);
		button_berchnen.setBounds(395, 350, 385, 55);
		button_berchnen.setText("Ausrechnen!");

		button_speichern = new Button(shell, SWT.NONE);
		button_speichern.setBounds(395, 420, 385, 55);
		button_speichern.setText("Speichern!");

		button_reset = new Button(shell, SWT.NONE);
		button_reset.setBounds(395, 489, 385, 55);
		button_reset.setText("Zurücksetzen!");
	      
	      

		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		makeController();
	}
	
	public void makeController(){
		MainGUIController c = new MainGUIController( button_reset,  button_speichern,
				 button_berchnen,  label_analyse_gesamt_result,
				 label_analyse_rechenweg_result,
				 label_analyse_klassenarbeiten_result,
				 label_analyse_tests_result,  label_analyse_datum_result,
				 button_ka_aktiv_3,  text_ka_note_3,
				 combo_ka_wertigkeit_3,  text_ka_bemerkung_3,
				 button_ka_aktiv_2,  text_ka_note_2,
				 combo_ka_wertigkeit_2,  text_ka_bemerkung_2,
				 button_ka_aktiv_1,  text_ka_note_1,
				 combo_ka_wertigkeit_1,  text_ka_bemerkung_1,
				 button_lk_aktiv_15,  text_lk_note_15,
				 combo_lk_wertigkeit_15,  text_lk_bemerkung_15,
				 button_lk_aktiv_14,  text_lk_note_14,
				 combo_lk_wertigkeit_14,  text_lk_bemerkung_14,
				 button_lk_aktiv_13,  text_lk_note_13,
				 combo_lk_wertigkeit_13,  text_lk_bemerkung_13,
				 button_lk_aktiv_12,  text_lk_note_12,
				 combo_lk_wertigkeit_12,  text_lk_bemerkung_12,
				 button_lk_aktiv_11,  text_lk_note_11,
				 combo_lk_wertigkeit_11,  text_lk_bemerkung_11,
				 button_lk_aktiv_10,  text_lk_note_10,
				 combo_lk_wertigkeit_10,  text_lk_bemerkung_10,
				 button_lk_aktiv_9,  text_lk_note_9,
				 combo_lk_wertigkeit_9,  text_lk_bemerkung_9,
				 button_lk_aktiv_8,  text_lk_note_8,
				 combo_lk_wertigkeit_8,  text_lk_bemerkung_8,
				 button_lk_aktiv_7,  text_lk_note_7,
				 combo_lk_wertigkeit_7,  text_lk_bemerkung_7,
				 button_lk_aktiv_6,  text_lk_note_6,
				 combo_lk_wertigkeit_6,  text_lk_bemerkung_6,
				 button_lk_aktiv_5,  text_lk_note_5,
				 combo_lk_wertigkeit_5,  text_lk_bemerkung_5,
				 button_lk_aktiv_4,  text_lk_note_4,
				 combo_lk_wertigkeit_4,  text_lk_bemerkung_4,
				 button_lk_aktiv_3,  text_lk_note_3,
				 combo_lk_wertigkeit_3,  text_lk_bemerkung_3,
				 button_lk_aktiv_2,  text_lk_note_2,
				 combo_lk_wertigkeit_2,  text_lk_bemerkung_2,
				 text_lk_bemerkung_1,  combo_lk_wertigkeit_1,
				 text_lk_note_1,  button_lk_aktiv_1);
	}
}
```


```
public class MainGUIController {
	
	private Button button_reset;
	private Button button_speichern;
	private Button button_berchnen;
	
	private Label label_analyse_gesamt_result;
	private Label label_analyse_rechenweg_result;
	private Label label_analyse_klassenarbeiten_result;
	private Label label_analyse_tests_result;
	private Label label_analyse_datum_result;
	
	private Button button_ka_aktiv_3;
	private Text text_ka_note_3;
	private Combo combo_ka_wertigkeit_3;
	private Text text_ka_bemerkung_3;
	
	private Button button_ka_aktiv_2;
	private Text text_ka_note_2;
	private Combo combo_ka_wertigkeit_2;
	private Text text_ka_bemerkung_2;
	
	private Button button_ka_aktiv_1;
	private Text text_ka_note_1;
	private Combo combo_ka_wertigkeit_1;
	private Text text_ka_bemerkung_1;
	
	private Button button_lk_aktiv_15;
	private Text text_lk_note_15;
	private Combo combo_lk_wertigkeit_15;
	private Text text_lk_bemerkung_15;
	
	private Button button_lk_aktiv_14;
	private Text text_lk_note_14;
	private Combo combo_lk_wertigkeit_14;
	private Text text_lk_bemerkung_14;
	
	private Button button_lk_aktiv_13;
	private Text text_lk_note_13;
	private Combo combo_lk_wertigkeit_13;
	private Text text_lk_bemerkung_13;
	
	private Button button_lk_aktiv_12;
	private Text text_lk_note_12;
	private Combo combo_lk_wertigkeit_12;
	private Text text_lk_bemerkung_12;
	
	private Button button_lk_aktiv_11;
	private Text text_lk_note_11;
	private Combo combo_lk_wertigkeit_11;
	private Text text_lk_bemerkung_11;
	
	private Button button_lk_aktiv_10;
	private Text text_lk_note_10;
	private Combo combo_lk_wertigkeit_10;
	private Text text_lk_bemerkung_10;
	
	private Button button_lk_aktiv_9;
	private Text text_lk_note_9;
	private Combo combo_lk_wertigkeit_9;
	private Text text_lk_bemerkung_9;
	
	private Button button_lk_aktiv_8;
	private Text text_lk_note_8;
	private Combo combo_lk_wertigkeit_8;
	private Text text_lk_bemerkung_8;
	
	private Button button_lk_aktiv_7;
	private Text text_lk_note_7;
	private Combo combo_lk_wertigkeit_7;
	private Text text_lk_bemerkung_7;
	
	private Button button_lk_aktiv_6;
	private Text text_lk_note_6;
	private Combo combo_lk_wertigkeit_6;
	private Text text_lk_bemerkung_6;
	
	private Button button_lk_aktiv_5;
	private Text text_lk_note_5;
	private Combo combo_lk_wertigkeit_5;
	private Text text_lk_bemerkung_5;
	
	private Button button_lk_aktiv_4;
	private Text text_lk_note_4;
	private Combo combo_lk_wertigkeit_4;
	private Text text_lk_bemerkung_4;
	
	private Button button_lk_aktiv_3;
	private Text text_lk_note_3;
	private Combo combo_lk_wertigkeit_3;
	private Text text_lk_bemerkung_3;
	
	private Button button_lk_aktiv_2;
	private Text text_lk_note_2;
	private Combo combo_lk_wertigkeit_2;
	private Text text_lk_bemerkung_2;
	
	private Text text_lk_bemerkung_1;
	private Combo combo_lk_wertigkeit_1;
	private Text text_lk_note_1;
	private Button button_lk_aktiv_1;

	public MainGUIController(Button button_reset, Button button_speichern,
			Button button_berchnen, Label label_analyse_gesamt_result,
			Label label_analyse_rechenweg_result,
			Label label_analyse_klassenarbeiten_result,
			Label label_analyse_tests_result, Label label_analyse_datum_result,
			Button button_ka_aktiv_3, Text text_ka_note_3,
			Combo combo_ka_wertigkeit_3, Text text_ka_bemerkung_3,
			Button button_ka_aktiv_2, Text text_ka_note_2,
			Combo combo_ka_wertigkeit_2, Text text_ka_bemerkung_2,
			Button button_ka_aktiv_1, Text text_ka_note_1,
			Combo combo_ka_wertigkeit_1, Text text_ka_bemerkung_1,
			Button button_lk_aktiv_15, Text text_lk_note_15,
			Combo combo_lk_wertigkeit_15, Text text_lk_bemerkung_15,
			Button button_lk_aktiv_14, Text text_lk_note_14,
			Combo combo_lk_wertigkeit_14, Text text_lk_bemerkung_14,
			Button button_lk_aktiv_13, Text text_lk_note_13,
			Combo combo_lk_wertigkeit_13, Text text_lk_bemerkung_13,
			Button button_lk_aktiv_12, Text text_lk_note_12,
			Combo combo_lk_wertigkeit_12, Text text_lk_bemerkung_12,
			Button button_lk_aktiv_11, Text text_lk_note_11,
			Combo combo_lk_wertigkeit_11, Text text_lk_bemerkung_11,
			Button button_lk_aktiv_10, Text text_lk_note_10,
			Combo combo_lk_wertigkeit_10, Text text_lk_bemerkung_10,
			Button button_lk_aktiv_9, Text text_lk_note_9,
			Combo combo_lk_wertigkeit_9, Text text_lk_bemerkung_9,
			Button button_lk_aktiv_8, Text text_lk_note_8,
			Combo combo_lk_wertigkeit_8, Text text_lk_bemerkung_8,
			Button button_lk_aktiv_7, Text text_lk_note_7,
			Combo combo_lk_wertigkeit_7, Text text_lk_bemerkung_7,
			Button button_lk_aktiv_6, Text text_lk_note_6,
			Combo combo_lk_wertigkeit_6, Text text_lk_bemerkung_6,
			Button button_lk_aktiv_5, Text text_lk_note_5,
			Combo combo_lk_wertigkeit_5, Text text_lk_bemerkung_5,
			Button button_lk_aktiv_4, Text text_lk_note_4,
			Combo combo_lk_wertigkeit_4, Text text_lk_bemerkung_4,
			Button button_lk_aktiv_3, Text text_lk_note_3,
			Combo combo_lk_wertigkeit_3, Text text_lk_bemerkung_3,
			Button button_lk_aktiv_2, Text text_lk_note_2,
			Combo combo_lk_wertigkeit_2, Text text_lk_bemerkung_2,
			Text text_lk_bemerkung_1, Combo combo_lk_wertigkeit_1,
			Text text_lk_note_1, Button button_lk_aktiv_1) {
		super();
		this.button_reset = button_reset;
		this.button_speichern = button_speichern;
		this.button_berchnen = button_berchnen;
		this.label_analyse_gesamt_result = label_analyse_gesamt_result;
		this.label_analyse_rechenweg_result = label_analyse_rechenweg_result;
		this.label_analyse_klassenarbeiten_result = label_analyse_klassenarbeiten_result;
		this.label_analyse_tests_result = label_analyse_tests_result;
		this.label_analyse_datum_result = label_analyse_datum_result;
		this.button_ka_aktiv_3 = button_ka_aktiv_3;
		this.text_ka_note_3 = text_ka_note_3;
		this.combo_ka_wertigkeit_3 = combo_ka_wertigkeit_3;
		this.text_ka_bemerkung_3 = text_ka_bemerkung_3;
		this.button_ka_aktiv_2 = button_ka_aktiv_2;
		this.text_ka_note_2 = text_ka_note_2;
		this.combo_ka_wertigkeit_2 = combo_ka_wertigkeit_2;
		this.text_ka_bemerkung_2 = text_ka_bemerkung_2;
		this.button_ka_aktiv_1 = button_ka_aktiv_1;
		this.text_ka_note_1 = text_ka_note_1;
		this.combo_ka_wertigkeit_1 = combo_ka_wertigkeit_1;
		this.text_ka_bemerkung_1 = text_ka_bemerkung_1;
		this.button_lk_aktiv_15 = button_lk_aktiv_15;
		this.text_lk_note_15 = text_lk_note_15;
		this.combo_lk_wertigkeit_15 = combo_lk_wertigkeit_15;
		this.text_lk_bemerkung_15 = text_lk_bemerkung_15;
		this.button_lk_aktiv_14 = button_lk_aktiv_14;
		this.text_lk_note_14 = text_lk_note_14;
		this.combo_lk_wertigkeit_14 = combo_lk_wertigkeit_14;
		this.text_lk_bemerkung_14 = text_lk_bemerkung_14;
		this.button_lk_aktiv_13 = button_lk_aktiv_13;
		this.text_lk_note_13 = text_lk_note_13;
		this.combo_lk_wertigkeit_13 = combo_lk_wertigkeit_13;
		this.text_lk_bemerkung_13 = text_lk_bemerkung_13;
		this.button_lk_aktiv_12 = button_lk_aktiv_12;
		this.text_lk_note_12 = text_lk_note_12;
		this.combo_lk_wertigkeit_12 = combo_lk_wertigkeit_12;
		this.text_lk_bemerkung_12 = text_lk_bemerkung_12;
		this.button_lk_aktiv_11 = button_lk_aktiv_11;
		this.text_lk_note_11 = text_lk_note_11;
		this.combo_lk_wertigkeit_11 = combo_lk_wertigkeit_11;
		this.text_lk_bemerkung_11 = text_lk_bemerkung_11;
		this.button_lk_aktiv_10 = button_lk_aktiv_10;
		this.text_lk_note_10 = text_lk_note_10;
		this.combo_lk_wertigkeit_10 = combo_lk_wertigkeit_10;
		this.text_lk_bemerkung_10 = text_lk_bemerkung_10;
		this.button_lk_aktiv_9 = button_lk_aktiv_9;
		this.text_lk_note_9 = text_lk_note_9;
		this.combo_lk_wertigkeit_9 = combo_lk_wertigkeit_9;
		this.text_lk_bemerkung_9 = text_lk_bemerkung_9;
		this.button_lk_aktiv_8 = button_lk_aktiv_8;
		this.text_lk_note_8 = text_lk_note_8;
		this.combo_lk_wertigkeit_8 = combo_lk_wertigkeit_8;
		this.text_lk_bemerkung_8 = text_lk_bemerkung_8;
		this.button_lk_aktiv_7 = button_lk_aktiv_7;
		this.text_lk_note_7 = text_lk_note_7;
		this.combo_lk_wertigkeit_7 = combo_lk_wertigkeit_7;
		this.text_lk_bemerkung_7 = text_lk_bemerkung_7;
		this.button_lk_aktiv_6 = button_lk_aktiv_6;
		this.text_lk_note_6 = text_lk_note_6;
		this.combo_lk_wertigkeit_6 = combo_lk_wertigkeit_6;
		this.text_lk_bemerkung_6 = text_lk_bemerkung_6;
		this.button_lk_aktiv_5 = button_lk_aktiv_5;
		this.text_lk_note_5 = text_lk_note_5;
		this.combo_lk_wertigkeit_5 = combo_lk_wertigkeit_5;
		this.text_lk_bemerkung_5 = text_lk_bemerkung_5;
		this.button_lk_aktiv_4 = button_lk_aktiv_4;
		this.text_lk_note_4 = text_lk_note_4;
		this.combo_lk_wertigkeit_4 = combo_lk_wertigkeit_4;
		this.text_lk_bemerkung_4 = text_lk_bemerkung_4;
		this.button_lk_aktiv_3 = button_lk_aktiv_3;
		this.text_lk_note_3 = text_lk_note_3;
		this.combo_lk_wertigkeit_3 = combo_lk_wertigkeit_3;
		this.text_lk_bemerkung_3 = text_lk_bemerkung_3;
		this.button_lk_aktiv_2 = button_lk_aktiv_2;
		this.text_lk_note_2 = text_lk_note_2;
		this.combo_lk_wertigkeit_2 = combo_lk_wertigkeit_2;
		this.text_lk_bemerkung_2 = text_lk_bemerkung_2;
		this.text_lk_bemerkung_1 = text_lk_bemerkung_1;
		this.combo_lk_wertigkeit_1 = combo_lk_wertigkeit_1;
		this.text_lk_note_1 = text_lk_note_1;
		this.button_lk_aktiv_1 = button_lk_aktiv_1;		
		initialise();
	
	}
	
	public void initialise(){
		
		text_lk_note_1.setEnabled(false);
	}
	
	
	
	

}
```


----------



## foobar (18. Sep 2004)

> Ich kann komischerweise aus der Controller Klasse keine GUI Elemente in der GUi Klasse ändern. Was mache ich falsch bzw was ist zu beachten?


Die Gui-Elemente sind auch alle als privat deklariert, ist also kein Wunder daß du nicht darauf zugreifen kannst, da die Elemente für andere Klassen nicht sichtbar sind.


----------



## Mork0075 (18. Sep 2004)

Aber genau deshalb hab ich sie mir ja mittels Konstruktor in die Controller Klasse geholt. Oder hab ich da nen Denkfehler?


----------



## foobar (18. Sep 2004)

Stimmt, hab ich übersehen. Und was funktioniert jetzt nicht? Was für eine Exception wird geworfen?


----------



## Mork0075 (18. Sep 2004)

Keine Exception. Es wird nur einfach keine Aktion ausgeführt. Sprich ich kann zb kein setText auf ein Label machen oder sowas in der Art.


----------



## foobar (18. Sep 2004)

Ich weiß ja nicht was du vor hast, aber mit MVC hat das nicht viel zu tun.
http://csis.pace.edu/~bergin/mvc/mvcgui.html
http://de.wikipedia.org/wiki/MVC


----------



## Mork0075 (18. Sep 2004)

@ foobar

Nein? Ich trenne Model View und Controller. Was ist daran nicht MVC?


----------

