ParameterArea Buttons für die Beispiele
This commit is contained in:
parent
c5d2060d37
commit
e2c2038531
49
.idea/workspace.xml
generated
49
.idea/workspace.xml
generated
@ -4,12 +4,12 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="Beispiele überarbeitet">
|
||||
<list default="true" id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="LegendArea gestaltet">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/OurApplication/OurApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/OurApplication/OurApplication.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/OurApplication/OurLegendArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/OurApplication/OurLegendArea.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/ProjektGraph/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/ProjektGraph/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/OurApplication/OurParameterArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/OurApplication/OurParameterArea.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/ProjektGraph/OurApplication/OurApplication.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/ProjektGraph/OurApplication/OurApplication.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/ProjektGraph/OurApplication/OurLegendArea.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/ProjektGraph/OurApplication/OurLegendArea.class" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -34,16 +34,17 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"Application.Display.executor": "Run",
|
||||
"Application.OurApplication.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "C:/Git/ProjektGraphMain"
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"Application.Display.executor": "Run",
|
||||
"Application.OurApplication.executor": "Debug",
|
||||
"Application.OurLegendArea.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "C:/Git/ProjektGraphMain"
|
||||
}
|
||||
}</component>
|
||||
}]]></component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="C:\Git\ProjektGraph" />
|
||||
@ -134,7 +135,15 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720311867957</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="10" />
|
||||
<task id="LOCAL-00010" summary="LegendArea gestaltet">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720347450647</created>
|
||||
<option name="number" value="00010" />
|
||||
<option name="presentableId" value="LOCAL-00010" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720347450647</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="11" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
@ -155,6 +164,18 @@
|
||||
<MESSAGE value="Tests with marking of Edges and Vertexes Adding Visualisation of Edge weight and Vertex name fixed AStar" />
|
||||
<MESSAGE value="small fix" />
|
||||
<MESSAGE value="Beispiele überarbeitet" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Beispiele überarbeitet" />
|
||||
<MESSAGE value="LegendArea gestaltet" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="LegendArea gestaltet" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/OurApplication/OurApplication.java</url>
|
||||
<line>49</line>
|
||||
<option name="timeStamp" value="1" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
</project>
|
@ -46,7 +46,7 @@ public class OurApplication {
|
||||
|
||||
ExampleGraphs temp = new ExampleGraphs();
|
||||
myGraph = temp.example1();
|
||||
|
||||
//sean: Ich wollte erst hier dann das ausgewählte Beispiel reinhauen, jedoch wird das hier nur einmal am Anfang aufgerufen
|
||||
System.out.println(myGraph.toString());
|
||||
|
||||
|
||||
|
@ -66,15 +66,4 @@ public class OurLegendArea extends LegendArea{
|
||||
g.drawLine(10, y + 10, 30, y + 10); // Zeichnet eine horizontale Linie
|
||||
g.drawString("Kanten Markierung", 40, y + 15); // Zeichnet die Beschreibung neben der Linie
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
JFrame frame = new JFrame("Legend Area Example");
|
||||
OurLegendArea legendArea = new OurLegendArea();
|
||||
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setSize(300, 250); // Angepasste Größe, um das neue Element aufzunehmen
|
||||
frame.add(legendArea.getScrollPane());
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +1,15 @@
|
||||
package OurApplication;
|
||||
|
||||
import graph.DirectedGraph;
|
||||
import graph.EdgeMarking;
|
||||
import graph.ExampleGraphs;
|
||||
import graph.VertexMarking;
|
||||
import visualisation.ParameterArea;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
/**
|
||||
* This class provides an example for using visualization.ParameterArea.
|
||||
@ -14,7 +21,16 @@ import javax.swing.*;
|
||||
public class OurParameterArea extends ParameterArea{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private JRadioButton button1;
|
||||
private JRadioButton button2;
|
||||
private JRadioButton button3;
|
||||
private JRadioButton button4;
|
||||
|
||||
private ExampleGraphs temp;
|
||||
private int selectedExample;
|
||||
|
||||
|
||||
/** TextField containing maximum sum up value. */
|
||||
protected JTextField maxValue;
|
||||
|
||||
@ -24,8 +40,76 @@ public class OurParameterArea extends ParameterArea{
|
||||
*/
|
||||
public OurParameterArea() {
|
||||
super();
|
||||
temp = new ExampleGraphs();
|
||||
selectedExample = 1; // Standardmäßig Beispiel 1
|
||||
|
||||
setBorder(BorderFactory.createTitledBorder("ParameterArea"));
|
||||
|
||||
// Hier Elemente adden
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user