ProjektGraph/OurApplication/OurApplication.java

70 lines
2.6 KiB
Java

package OurApplication;
import graph.*;
import logging.LogElementList;
import javax.swing.*;
/**
* Entry point for the OurApplication, demonstrating logging and visualization integration.
* This application sets up a graphical interface using Swing components to visualize graphs
* and log algorithmic operations.
*
* @see OurAlgorithm Provides the algorithmic logic for processing graphs.
* @see OurDrawArea Displays and interacts with the graph visualization.
* @see OurHybridWindow Combines visual components and algorithmic operations.
* @see OurLogElement Represents individual logging elements.
* @see OurParameterArea Manages parameters for graph operations.
* @see OurTextArea Displays log messages and algorithm progress.
* @see OurLegendArea Provides legend information for the graphical interface.
* @see JPanel Swing panel used in the graphical interface.
*/
public class OurApplication {
/**
* Default constructor for OurApplication.
* Initializes the application components and starts the graphical interface.
*/
public OurApplication() {
super();
}
/**
* Main method to launch the OurApplication.
* Initializes necessary components, creates a graphical window, and starts the application.
*
* @param args command-line arguments (not used)
*/
public static void main(String[] args){
// Create a directed graph instance
DirectedGraph<VertexMarking, EdgeMarking> myGraph = new DirectedGraph<>();
System.out.println(myGraph.toString());
// Initialize logging elements
LogElementList<OurLogElement> logList = new LogElementList<>();
// Create UI components
OurParameterArea parameterArea = new OurParameterArea();
OurMethodButtons methodButtons = new OurMethodButtons();
OurDrawArea drawArea = new OurDrawArea(logList, "GraphVisualization");
OurTextArea textArea = new OurTextArea(logList);
OurAlgorithm algorithm = new OurAlgorithm(parameterArea, methodButtons);
OurLegendArea legendArea = new OurLegendArea();
// Create a HybridWindow instance combining all UI components
OurHybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea, OurMethodButtons> applet =
new OurHybridWindow<>(drawArea, textArea, parameterArea, algorithm, logList, legendArea, methodButtons);
// Create and configure the main JFrame
JFrame frame = new JFrame("Visualise");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(applet);
frame.pack();
applet.init();
applet.start();
frame.setSize(1350, 800);
frame.setVisible(true);
}
}