85 lines
2.2 KiB
Java
85 lines
2.2 KiB
Java
package View;
|
|
|
|
import javax.swing.*;
|
|
import java.awt.*;
|
|
import java.awt.event.ActionEvent;
|
|
import java.awt.event.ActionListener;
|
|
import java.util.LinkedList;
|
|
|
|
/**
|
|
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
|
|
*
|
|
* @Author: Armin Wolf
|
|
* @Email: a_wolf28@uni-muenster.de
|
|
* @Date: 28.05.2017.
|
|
*/
|
|
public class MainFrame<T> extends View {
|
|
|
|
//TODO refactoring
|
|
private JButton button1;
|
|
private JButton button2;
|
|
private JButton button3;
|
|
private JDialog dialog;
|
|
private ArrangementDialog arrangement;
|
|
|
|
public MainFrame(){
|
|
initGUI();
|
|
}
|
|
|
|
|
|
protected void initGUI(){
|
|
this.setTitle("MainFrame");
|
|
this.setSize(800,800);
|
|
this.setLayout(new FlowLayout());
|
|
dialog = new JDialog();
|
|
dialog.setSize(new Dimension(700,470));
|
|
dialog.setTitle("Arrangement Dialog");
|
|
dialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
|
|
button1 = new JButton("Button 1");
|
|
button2 = new JButton("Button 2");
|
|
button3 = new JButton("Button 3");
|
|
|
|
button1.addActionListener(new ActionListener() {
|
|
@Override
|
|
public void actionPerformed(ActionEvent e) {
|
|
getPresenter().setActionByView();
|
|
}
|
|
});
|
|
this.add(button1);
|
|
this.add(button2);
|
|
this.add(button3);
|
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
this.setVisible(true);
|
|
}
|
|
|
|
@Override
|
|
public void createArrangement() {
|
|
if (arrangement == null){
|
|
arrangement = new ArrangementDialog();
|
|
arrangement.setPrameters(getPresenter().getMax(), getPresenter().getMin(), getPresenter().getLines());
|
|
arrangement.createArrangement();
|
|
SwingUtilities.invokeLater(new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
dialog.add(arrangement);
|
|
dialog.setVisible(true);
|
|
}
|
|
});
|
|
} else {
|
|
dialog.setVisible(true);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
@Override
|
|
public void createLine() {
|
|
//TODO
|
|
}
|
|
|
|
@Override
|
|
public void createPlot() {
|
|
//TODO
|
|
}
|
|
}
|