2024-07-02 19:13:30 +00:00
|
|
|
|
package OurApplication;
|
2024-06-15 19:55:30 +00:00
|
|
|
|
|
2024-07-07 10:58:33 +00:00
|
|
|
|
import graph.DirectedGraph;
|
|
|
|
|
import graph.EdgeMarking;
|
|
|
|
|
import graph.ExampleGraphs;
|
|
|
|
|
import graph.VertexMarking;
|
2024-07-02 19:13:30 +00:00
|
|
|
|
import visualisation.ParameterArea;
|
|
|
|
|
|
|
|
|
|
import javax.swing.*;
|
2024-07-07 10:58:33 +00:00
|
|
|
|
import java.awt.*;
|
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
|
import java.awt.event.ActionListener;
|
2024-06-15 19:55:30 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This class provides an example for using visualization.ParameterArea.
|
2024-07-02 19:13:30 +00:00
|
|
|
|
* @see ParameterArea
|
|
|
|
|
* @author MSch<EFBFBD>fer
|
2024-06-15 19:55:30 +00:00
|
|
|
|
* DHBW Stuttgart/Campus Horb AI2008<br>
|
|
|
|
|
* <br>
|
|
|
|
|
*/
|
2024-07-02 19:13:30 +00:00
|
|
|
|
public class OurParameterArea extends ParameterArea{
|
2024-06-15 19:55:30 +00:00
|
|
|
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
2024-07-07 10:58:33 +00:00
|
|
|
|
|
|
|
|
|
private JRadioButton button1;
|
|
|
|
|
private JRadioButton button2;
|
|
|
|
|
private JRadioButton button3;
|
|
|
|
|
private JRadioButton button4;
|
|
|
|
|
|
|
|
|
|
private ExampleGraphs temp;
|
|
|
|
|
private int selectedExample;
|
|
|
|
|
|
|
|
|
|
|
2024-06-15 19:55:30 +00:00
|
|
|
|
/** TextField containing maximum sum up value. */
|
|
|
|
|
protected JTextField maxValue;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Standard constructor.
|
|
|
|
|
* Creates SumUpParameterArea with an empty JTextField.
|
|
|
|
|
*/
|
2024-07-02 19:13:30 +00:00
|
|
|
|
public OurParameterArea() {
|
2024-06-15 19:55:30 +00:00
|
|
|
|
super();
|
2024-07-07 10:58:33 +00:00
|
|
|
|
temp = new ExampleGraphs();
|
|
|
|
|
selectedExample = 1; // Standardmäßig Beispiel 1
|
|
|
|
|
|
2024-06-15 19:55:30 +00:00
|
|
|
|
setBorder(BorderFactory.createTitledBorder("ParameterArea"));
|
|
|
|
|
|
2024-07-07 10:58:33 +00:00
|
|
|
|
// Layout-Manager setzen, um die Buttons vertikal anzuordnen
|
|
|
|
|
setLayout(new GridLayout(4, 1, 5, 5)); // 4 Zeilen, 1 Spalte, 5 Pixel Abstand
|
|
|
|
|
|
|
|
|
|
// Buttons erstellen
|
|
|
|
|
button1 = new JRadioButton("Beispiel 1", true);
|
|
|
|
|
button2 = new JRadioButton("Beispiel 2");
|
|
|
|
|
button3 = new JRadioButton("Beispiel 3");
|
|
|
|
|
button4 = new JRadioButton("Beispiel 4");
|
|
|
|
|
|
|
|
|
|
// ButtonGroup erstellen und Buttons hinzufügen, um die gegenseitige Ausschließung zu gewährleisten
|
|
|
|
|
ButtonGroup group = new ButtonGroup();
|
|
|
|
|
group.add(button1);
|
|
|
|
|
group.add(button2);
|
|
|
|
|
group.add(button3);
|
|
|
|
|
group.add(button4);
|
|
|
|
|
|
|
|
|
|
// ActionListener hinzufügen
|
|
|
|
|
button1.addActionListener(new ActionListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
selectedExample = 1;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
button2.addActionListener(new ActionListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
selectedExample = 2;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
button3.addActionListener(new ActionListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
selectedExample = 3;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
button4.addActionListener(new ActionListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
selectedExample = 4;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Buttons zum Panel hinzufügen
|
|
|
|
|
add(button1);
|
|
|
|
|
add(button2);
|
|
|
|
|
add(button3);
|
|
|
|
|
add(button4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DirectedGraph<VertexMarking, EdgeMarking> getSelectedGraph() {
|
|
|
|
|
ExampleGraphs temp = new ExampleGraphs();
|
|
|
|
|
switch (selectedExample) {
|
|
|
|
|
case 2:
|
|
|
|
|
return temp.example2();
|
|
|
|
|
case 3:
|
|
|
|
|
return temp.example3();
|
|
|
|
|
case 4:
|
|
|
|
|
return temp.example4();
|
|
|
|
|
case 1:
|
|
|
|
|
default:
|
|
|
|
|
return temp.example1();
|
|
|
|
|
}
|
2024-07-02 22:46:21 +00:00
|
|
|
|
}
|
2024-07-07 10:58:33 +00:00
|
|
|
|
|
2024-06-15 19:55:30 +00:00
|
|
|
|
}
|