Browse Source

Added readme.md and license.txt

master
Máté Kukri 2 years ago
parent
commit
d2f6eb6af5
  1. 13
      license.txt
  2. 35
      readme.md
  3. 2
      src/test/java/xyz/mkukri/SwingGraph/TestGui.java

13
license.txt

@ -0,0 +1,13 @@
Copyright (c) 2020, Máté Kukri
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

35
readme.md

@ -0,0 +1,35 @@
# SwingGraph
Java graph drawing library. It's purpose is to simplify building graphs out of Swing
GUI components. More edge style and automatic layouting support is planned.
## Usage
Build using maven the usual way, or use the pre-compiled jars provided. Add the jar
as a dependency to your project and use the `SwingGraph` component to render graphs.
It's API consists of two main methods:
```
/**
* Add a vertex to the panel
* @param v AWT or Swing component of the vertex
*/
public void addVertex(Component v)
```
Use this for adding vertices two the graph, vertices can be any Swing component,
including JPanels with child components.
```
/**
* Add an edge connecting v1 to v2
* @param v1 AWT or Swing component of the v1
* @param v2 AWT or Swing component of the v2
*/
public void addEdge(Component v1, Component v2)
```
Use this to add a directed edge connecting v1 to v2. Non-directional edges are currently
not supported.
Changing the starting size of vertices can be accomplished by calling `setPreferredSize`
on them before adding them to the graph. Similarly the starting position can be adjusted
using `setLocation`.
An example application called `TestGui` is provided.
## License
SwingGraph is released under the terms of the ISC license, check `license.txt` for more
details.

2
src/test/java/xyz/mkukri/SwingGraph/TestGui.java

@ -1,7 +1,5 @@
package xyz.mkukri.SwingGraph;
import xyz.mkukri.SwingGraph.edge.EdgeRendererMid;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JFrame;

Loading…
Cancel
Save