98 lines
2.7 KiB
Java
98 lines
2.7 KiB
Java
package View.Panels;
|
|
|
|
import View.MainFrame;
|
|
|
|
import javax.swing.*;
|
|
import javax.swing.border.TitledBorder;
|
|
import javax.swing.table.DefaultTableModel;
|
|
import java.awt.*;
|
|
|
|
/**
|
|
* Created by armin on 02.08.17.
|
|
*/
|
|
public class EvaluationPanel extends JPanel{
|
|
|
|
private final MainFrame view;
|
|
private JTable table;
|
|
private JButton start;
|
|
private JButton stop;
|
|
|
|
private JPanel comp;
|
|
private JTextField iIteration;
|
|
private JTextField iSlope;
|
|
private JTextField iYinterception;
|
|
private JLabel lIteration;
|
|
private JLabel lSlope;
|
|
private JLabel lYinterception;
|
|
|
|
private DefaultTableModel model;
|
|
private JPanel buttonPanel;
|
|
|
|
public EvaluationPanel(MainFrame view){
|
|
super();
|
|
this.view = view;
|
|
this.setLayout(new BorderLayout());
|
|
this.setBorder(new TitledBorder("Evaluation der Algorithmen"));
|
|
addComponents();
|
|
}
|
|
|
|
private void addComponents(){
|
|
lIteration = new JLabel("Interationen");
|
|
lSlope = new JLabel("Steigung");
|
|
lYinterception = new JLabel("y-Achsenabschnitt");
|
|
|
|
iIteration = new JTextField();
|
|
iSlope = new JTextField();
|
|
iYinterception = new JTextField();
|
|
start = new JButton("Start");
|
|
stop = new JButton("Stop");
|
|
|
|
buttonPanel = new JPanel(new FlowLayout());
|
|
buttonPanel.add(start);
|
|
//buttonPanel.add(stop);
|
|
|
|
comp = new JPanel();
|
|
comp.setLayout(new GridLayout(0,2));
|
|
comp.add(lIteration);
|
|
comp.add(iIteration);
|
|
comp.add(lSlope);
|
|
comp.add(iSlope);
|
|
comp.add(lYinterception);
|
|
comp.add(iYinterception);
|
|
|
|
start.addActionListener(e -> {
|
|
String[] params = {iSlope.getText(), iYinterception.getText(), iIteration.getText() };
|
|
view.getPresenter().startEvaluation(params);
|
|
});
|
|
|
|
stop.addActionListener(e -> {
|
|
view.getPresenter().stopEvaluation();
|
|
});
|
|
|
|
String[] selections = { "Schätzer","MSE", "RMSE", "MAE", "MdAE"};
|
|
model = new DefaultTableModel(){
|
|
@Override
|
|
public boolean isCellEditable(int row, int column) {
|
|
//all cells false
|
|
return false;
|
|
}
|
|
};
|
|
model.setColumnIdentifiers(selections);
|
|
|
|
table = new JTable(model);
|
|
table.setDragEnabled(true);
|
|
|
|
JScrollPane scrollPane = new JScrollPane(table);
|
|
scrollPane.setWheelScrollingEnabled(true);
|
|
this.add(scrollPane, BorderLayout.CENTER);
|
|
this.add(comp, BorderLayout.NORTH);
|
|
this.add(buttonPanel, BorderLayout.SOUTH);
|
|
}
|
|
|
|
public void appendData(Object[] row){
|
|
model.addRow(row);
|
|
this.repaint();
|
|
this.revalidate();
|
|
}
|
|
}
|