algorithms-for-computing-li.../src/main/java/View/SidePanel.java

62 lines
1.5 KiB
Java

package View;
import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.swing.border.MatteBorder;
import javax.swing.border.TitledBorder;
import java.awt.*;
/**
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
*
* @Author: Armin Wolf
* @Email: a_wolf28@uni-muenster.de
* @Date: 02.06.2017.
*/
public class SidePanel extends JPanel {
private JLabel[] labels;
private JTextField[] text;
private JPanel continer;
private GridBagConstraints gbc;
public SidePanel(){
this.setBorder(new TitledBorder("Eingabefelder"));
this.labels = new JLabel[10];
this.text = new JTextField[10];
this.setLayout(new BorderLayout());
this.continer = new JPanel();
continer.setLayout(new GridBagLayout());;
gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.NORTH;
gbc.fill = GridBagConstraints.HORIZONTAL;
for (int i=0;i<9;i++){
this.labels[i] = new JLabel("dummy "+i);
this.text[i] = new JTextField();
gbc.insets = new Insets(0, 5,0,0);
gbc.gridx = 0;
gbc.gridy = i;
gbc.weightx = 0.05;
gbc.weighty = 0.05;
continer.add(this.labels[i], gbc);
gbc.gridx = 1;
gbc.gridy = i;
gbc.weightx = 0.9;
gbc.weighty = 0.05;
gbc.insets = new Insets(0, 0,0,5);
continer.add(this.text[i], gbc);
}
this.add(continer, BorderLayout.NORTH);
}
}