问题描述
我想用Java绘制图形(节点和边)。然而,由于我不知道如何去做,所以我想在开始之前有一些建议。
我应该怎么做?
使用Graphics2D软件包,对吗?
节点的标签如何?我应该使用类似drawString的东西,并手动处理所有居中或为此创建一个JLabel?我可以将JLabel放在Graphics2D环境中吗?
我已经搜索过,但还没有找到任何简单的实现。如果你知道一个,请在你的答案中提供链接。
编辑:我正在寻找的解决方案应该能够删除节点,拖动节点,编辑标签,创建节点,全部使用鼠标事件。
谢谢。
是一个对象绘图程序的简单例子。
I want to draw graphs (nodes and edges) in Java. However, since I don't know how to go about it, I would like to have some advice before starting.
How should I do this?
use Graphics2D package, right?
How about the labels for the nodes? should I use something like drawString and handle all the "centering" manually or create a JLabel for that? Can I put a JLabel on a Graphics2D environment?
I have searched but haven't found any simple implementation of this. If you know of one, please provide the link in your answer.
edit: The solution I am looking for should be able to remove nodes, drag nodes, edit labels, create nodes, all with mouse events.
Thanks.
"Graph Panel is a simple example of an object drawing program."
这篇关于在java上绘制图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!