115 lines
2.9 KiB
Java
115 lines
2.9 KiB
Java
package View.Panels;
|
|
|
|
import View.PlotDialog;
|
|
import java.awt.BorderLayout;
|
|
import java.awt.Font;
|
|
import java.awt.GridBagConstraints;
|
|
import java.awt.GridBagLayout;
|
|
import java.awt.Insets;
|
|
import javax.swing.JButton;
|
|
import javax.swing.JLabel;
|
|
import javax.swing.JPanel;
|
|
import javax.swing.JTextField;
|
|
import javax.swing.border.TitledBorder;
|
|
|
|
/**
|
|
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
|
|
*
|
|
* @Author: Armin Wolf
|
|
* @Email: a_wolf28@uni-muenster.de
|
|
* @Date: 21.06.2017.
|
|
*/
|
|
public class RMPanel extends JPanel {
|
|
|
|
private JLabel labels;
|
|
private JTextField input;
|
|
private JButton startButton;
|
|
private JPanel continer;
|
|
private JPanel northPanel;
|
|
private JPanel centerPanel;
|
|
private PlotDialog plotDialog;
|
|
private GridBagConstraints gbc;
|
|
|
|
public RMPanel() {
|
|
this.labels = new JLabel();
|
|
|
|
this.input = new JTextField();
|
|
this.setLayout(new BorderLayout());
|
|
this.northPanel = new JPanel(new BorderLayout());
|
|
this.centerPanel = new JPanel(new BorderLayout());
|
|
this.northPanel.setBorder(new TitledBorder("Konfiguration"));
|
|
this.centerPanel.setBorder(new TitledBorder("Visualisierung"));
|
|
|
|
this.continer = new JPanel();
|
|
this.continer.setLayout(new GridBagLayout());
|
|
|
|
this.gbc = new GridBagConstraints();
|
|
this.gbc.anchor = GridBagConstraints.NORTH;
|
|
this.gbc.fill = GridBagConstraints.HORIZONTAL;
|
|
|
|
addTextfieldAndInput(0, "\u00df (0 < \u00df < 1)", 0.5);
|
|
|
|
|
|
this.startButton = new JButton("start");
|
|
gbc.insets = new Insets(30, 5, 10, 0);
|
|
gbc.gridx = 0;
|
|
gbc.gridy = 2;
|
|
gbc.weightx = 0.05;
|
|
gbc.weighty = 0.05;
|
|
continer.add(startButton, gbc);
|
|
|
|
this.northPanel.add(continer, BorderLayout.CENTER);
|
|
this.add(northPanel, BorderLayout.NORTH);
|
|
this.add(centerPanel, BorderLayout.CENTER);
|
|
}
|
|
|
|
|
|
private void addTextfieldAndInput(int row, String name, Double value) {
|
|
this.labels = new JLabel(name);
|
|
this.labels.setFont(new Font("SansSerif", Font.PLAIN, 13));
|
|
this.input = new JTextField();
|
|
this.input.setText("" + value);
|
|
|
|
gbc.insets = new Insets(0, 5, 0, 0);
|
|
gbc.gridx = 0;
|
|
gbc.gridy = row;
|
|
gbc.weightx = 0.05;
|
|
gbc.weighty = 0.05;
|
|
continer.add(this.labels, gbc);
|
|
|
|
gbc.gridx = 1;
|
|
gbc.gridy = row;
|
|
gbc.weightx = 0.9;
|
|
gbc.weighty = 0.05;
|
|
gbc.insets = new Insets(0, 0, 0, 5);
|
|
continer.add(this.input, gbc);
|
|
}
|
|
|
|
|
|
public JButton getStartButton() {
|
|
return startButton;
|
|
}
|
|
|
|
public String getInput() {
|
|
String input = "";
|
|
input = this.input.getText();
|
|
return input;
|
|
}
|
|
|
|
public void setInput(JTextField input) {
|
|
this.input = input;
|
|
}
|
|
|
|
public PlotDialog getPlotDialog() {
|
|
return plotDialog;
|
|
}
|
|
|
|
public void setPlotDialog(PlotDialog plotDialog) {
|
|
this.plotDialog = plotDialog;
|
|
this.centerPanel.add(plotDialog, BorderLayout.CENTER);
|
|
this.plotDialog.setVisible(true);
|
|
this.repaint();
|
|
this.revalidate();
|
|
}
|
|
}
|