panel.java
来自「用java实现的利用蚁群算法实现的tsp问题」· Java 代码 · 共 64 行
JAVA
64 行
import java.awt.Color;import java.awt.Graphics;import java.awt.Graphics2D;import javax.swing.JFrame;/*** This code was edited or generated using CloudGarden's Jigloo* SWT/Swing GUI Builder, which is free for non-commercial* use. If Jigloo is being used commercially (ie, by a corporation,* company or business for any purpose whatever) then you* should purchase a license for each developer using Jigloo.* Please visit www.cloudgarden.com for details.* Use of Jigloo implies acceptance of these licensing terms.* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.*/public class Panel extends javax.swing.JDialog { /** * Auto-generated main method to display this JDialog */ private Tsp tsp; public static void main(String[] args) { JFrame frame = new JFrame(); Panel inst = new Panel(frame); inst.setVisible(true); inst.run(); } public Panel(JFrame frame) { super(frame); initGUI(); tsp = new Tsp(this); } public void run() { tsp.tsp(); } private void initGUI() { try { { getContentPane().setBackground(new java.awt.Color(0,0,0)); } this.setSize(600, 600); } catch (Exception e) { e.printStackTrace(); } } public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setPaint(Color.BLACK); g2d.fillRect(0, 0, 600, 600); tsp.draw(g2d); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?