summaryrefslogtreecommitdiff
path: root/src/OptionWindow.java
blob: bbba5bc68d5f192e57cd20ba9816641a28814e4f (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JPanel;

import aufgaben.*;
import aufgaben.blatt1.*;

public class OptionWindow extends Frame {
	
	private final int width = 300, height = 300;
	private GridLayout layout;
	private JComboBox combo;
	private JButton button;
	private JPanel panel;
	private Aufgabe current;
	private Aufgabe[] aufgaben;
	
	public OptionWindow() {
		layout = getLayout();
		this.setTitle("Aufgabenauswahl");
		this.setResizable(false);
		this.setLayout(layout);
		this.setPreferredSize(new Dimension(width, height));
		aufgaben = new Aufgabe[] { new aufgaben.blatt1.Aufgabe1(), new aufgaben.blatt1.Aufgabe2a(), new aufgaben.blatt1.Aufgabe2b40(), new aufgaben.blatt1.Aufgabe2bEPIC(), new aufgaben.blatt1.Aufgabe2c40(), new aufgaben.blatt1.Aufgabe2c40UTF8(), new aufgaben.blatt1.Aufgabe2cEPIC(), new aufgaben.blatt1.Aufgabe2cEPICUTF8(), new aufgaben.blatt2.Aufgabe1(), new aufgaben.bildverarbeitung.Aufgabe1(), new aufgaben.bildverarbeitung.Aufgabe3(), new aufgaben.b20160604.Aufgabe1(), new aufgaben.b20160604.Aufgabe2(), new aufgaben.b20160604.Aufgabe3(), new aufgaben.b20160604.Aufgabe4(), new aufgaben.b20160411.Aufgabe1(), new aufgaben.b20160411.Aufgabe2(), new aufgaben.b20160411.Aufgabe3(), new aufgaben.b20160411.Aufgabe4(), new aufgaben.b20160411.Aufgabe5(), new aufgaben.b20160413.Image(), new aufgaben.b20160413.Aufgabe4(), new aufgaben.b20160413.Aufgabe6(), new aufgaben.b20160413.Zusatz1(), new aufgaben.b20160425.Aufgabe1(), new aufgaben.b20160425.Aufgabe2(), new aufgaben.b20160425.Aufgabe3(), new aufgaben.imageio.Aufgabe1(), new aufgaben.imageio.Komprimierung1() };
		combo = new JComboBox();
		for(int i = 0; i<aufgaben.length; i++) {
			combo.addItem(aufgaben[i].getName());
		}
		button = new JButton("Starten");
		button.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				aufgaben[combo.getSelectedIndex()].init();
				aufgaben[combo.getSelectedIndex()].setVisible(true);
			}
		});
		
		this.add(combo);
		this.add(button);
		
		this.pack();
		this.setVisible(true);
	}
	
	public GridLayout getLayout() {
		GridLayout layout = new GridLayout();
		layout.setColumns(1);
		layout.setRows(2);
		return layout;
	}

}