LegendArea gestaltet

This commit is contained in:
Sean Reich 2024-07-07 12:17:28 +02:00
parent 3629584d14
commit c5d2060d37
4 changed files with 104 additions and 23 deletions

View File

@ -4,11 +4,12 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="small fix">
<list default="true" id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="Beispiele überarbeitet">
<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$/graph/ExampleGraphs.java" beforeDir="false" afterPath="$PROJECT_DIR$/graph/ExampleGraphs.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/ProjektGraph/graph/ExampleGraphs.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/ProjektGraph/graph/ExampleGraphs.class" 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$/out/production/ProjektGraph/OurApplication/OurApplication.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/ProjektGraph/OurApplication/OurApplication.class" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -125,7 +126,15 @@
<option name="project" value="LOCAL" />
<updated>1720293774580</updated>
</task>
<option name="localTasksCounter" value="9" />
<task id="LOCAL-00009" summary="Beispiele überarbeitet">
<option name="closed" value="true" />
<created>1720311867957</created>
<option name="number" value="00009" />
<option name="presentableId" value="LOCAL-00009" />
<option name="project" value="LOCAL" />
<updated>1720311867957</updated>
</task>
<option name="localTasksCounter" value="10" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -145,6 +154,7 @@
<MESSAGE value="Stable Version 3.0" />
<MESSAGE value="Tests with marking of Edges and Vertexes&#10;Adding Visualisation of Edge weight &#10;and Vertex name&#10;fixed AStar" />
<MESSAGE value="small fix" />
<option name="LAST_COMMIT_MESSAGE" value="small fix" />
<MESSAGE value="Beispiele überarbeitet" />
<option name="LAST_COMMIT_MESSAGE" value="Beispiele überarbeitet" />
</component>
</project>

View File

@ -31,9 +31,50 @@ public class OurLegendArea extends LegendArea{
* Draws all elements and descriptions on the LegendArea
* @param g the Graphics object of the corresponding panel
*/
public void initialize(Graphics g){
//Create a new TitledBorder for the LegendArea
setBorder(BorderFactory.createTitledBorder("LegendArea"));
public void initialize(Graphics g) {
// Erstellt einen neuen TitledBorder für den Legendenbereich
setBorder(BorderFactory.createTitledBorder("LegendArea"));
// Zeichnet den roten Knoten (Start/End Knoten)
int y = 30; // Startposition für das Zeichnen der Legenden-Elemente
g.setColor(Color.RED);
g.fillOval(10, y, 20, 20); // Zeichnet einen kleinen Kreis (Knoten) mit der Farbe des Elements
g.setColor(Color.BLACK);
g.drawOval(10, y, 20, 20); // Zeichnet den Rand des Kreises
g.drawString("Start/End Knoten", 40, y + 15); // Zeichnet die Beschreibung neben dem Kreis
// Zeichnet den blauen Knoten (Besuchter Knoten)
y += 40; // Nach unten verschieben für das nächste Element
g.setColor(Color.BLUE);
g.fillOval(10, y, 20, 20); // Zeichnet einen kleinen Kreis (Knoten) mit der Farbe des Elements
g.setColor(Color.BLACK);
g.drawOval(10, y, 20, 20); // Zeichnet den Rand des Kreises
g.drawString("Besuchter Knoten", 40, y + 15); // Zeichnet die Beschreibung neben dem Kreis
// Zeichnet den gelben Knoten (Erreichbare Knoten)
y += 40; // Nach unten verschieben für das nächste Element
g.setColor(Color.YELLOW);
g.fillOval(10, y, 20, 20); // Zeichnet einen kleinen Kreis (Knoten) mit der Farbe des Elements
g.setColor(Color.BLACK);
g.drawOval(10, y, 20, 20); // Zeichnet den Rand des Kreises
g.drawString("Erreichbare Knoten", 40, y + 15); // Zeichnet die Beschreibung neben dem Kreis
// Zeichnet die schwarze Linie (Kanten Markierung)
y += 40; // Nach unten verschieben für das nächste Element
g.setColor(Color.BLACK);
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);
}
}

View File

@ -4,15 +4,18 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="Stable Version 3.0">
<change beforePath="$PROJECT_DIR$/graph/DirectedGraph.java" beforeDir="false" afterPath="$PROJECT_DIR$/graph/DirectedGraph.java" afterDir="false" />
</list>
<list default="true" id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="Beispiele überarbeitet" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="ebd1173cbc514ede7aa65ba6be90702c92e0e8b4" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
<option name="RESET_MODE" value="HARD" />
</component>
@ -25,16 +28,16 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"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">{
&quot;keyToString&quot;: {
&quot;Application.Display.executor&quot;: &quot;Run&quot;,
&quot;Application.OurApplication.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;main&quot;,
&quot;kotlin-language-version-configured&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;C:/Git/ProjektGraphMain&quot;
}
}]]></component>
}</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Git\ProjektGraph" />
@ -101,7 +104,31 @@
<option name="project" value="LOCAL" />
<updated>1720182049903</updated>
</task>
<option name="localTasksCounter" value="7" />
<task id="LOCAL-00007" summary="Tests with marking of Edges and Vertexes&#10;Adding Visualisation of Edge weight &#10;and Vertex name&#10;fixed AStar">
<option name="closed" value="true" />
<created>1720291413659</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1720291413659</updated>
</task>
<task id="LOCAL-00008" summary="small fix">
<option name="closed" value="true" />
<created>1720293774580</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1720293774580</updated>
</task>
<task id="LOCAL-00009" summary="Beispiele überarbeitet">
<option name="closed" value="true" />
<created>1720311867957</created>
<option name="number" value="00009" />
<option name="presentableId" value="LOCAL-00009" />
<option name="project" value="LOCAL" />
<updated>1720311867957</updated>
</task>
<option name="localTasksCounter" value="10" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -119,6 +146,9 @@
<MESSAGE value="Adding AStar Algorithm" />
<MESSAGE value="Stable Version with finished visualisation" />
<MESSAGE value="Stable Version 3.0" />
<option name="LAST_COMMIT_MESSAGE" value="Stable Version 3.0" />
<MESSAGE value="Tests with marking of Edges and Vertexes&#10;Adding Visualisation of Edge weight &#10;and Vertex name&#10;fixed AStar" />
<MESSAGE value="small fix" />
<MESSAGE value="Beispiele überarbeitet" />
<option name="LAST_COMMIT_MESSAGE" value="Beispiele überarbeitet" />
</component>
</project>