資源簡介
利用圖的遍歷實現節點間最短路徑的查找,以及刪除增加節點。包含文件:原碼和設計報告。

代碼片段和文件信息
import?java.awt.Container;
import?java.awt.Font;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?java.util.InputMismatchException;
import?java.util.List;
import?java.util.Scanner;
import?javax.swing.BorderFactory;
import?javax.swing.ImageIcon;
import?javax.swing.JButton;
import?javax.swing.Jframe;
import?javax.swing.JLabel;
import?javax.swing.JPanel;
import?javax.swing.JScrollPane;
import?javax.swing.JTextArea;
import?javax.swing.JTextField;
import?javax.swing.WindowConstants;
public?class?Main?extends?Jframe?implements?ActionListener?{
final?Font?font1?=?new?Font(“楷體“?Font.BOLD?18);
final?Font?font2?=?new?Font(“宋體“?Font.BOLD?32);
final?Font?font3?=?new?Font(“楷體“?Font.PLAIN?14);
SchoolMap?sh_map?=?new?SchoolMap();
JTextField?jt_view_sigle?=?new?JTextField();//查看景點信息的框
JTextField?path1?=?new?JTextField();
JTextField?path2?=?new?JTextField();//查看路徑的起點和終點
JTextField?add1?=?new?JTextField();
JTextField?add2?=?new?JTextField();//添加路徑的框
JTextField?len?=?new?JTextField();
JTextField?jt_del_path1?=?new?JTextField();
JTextField?jt_del_path2?=?new?JTextField();//刪除的起點和終點
JTextField?add_node?=?new?JTextField();
JTextArea?result?=?new?JTextArea();
public?Main(){
Node?A?=?new?Node(“圖書館“);
Node?B?=?new?Node(“足球場“);
Node?C?=?new?Node(“羽毛球場“);
Node?D?=?new?Node(“兵乓球場“);
Node?E?=?new?Node(“后山“);
Node?F?=?new?Node(“籃球場“);
sh_map.addpath_2(A?B?10);
sh_map.addpath_2(A?E?4);
sh_map.addpath_2(A?D?36);
sh_map.addpath_2(B?E?3);
sh_map.addpath_2(B?D?18);
sh_map.addpath_2(B?F?7);
sh_map.addpath_2(C?B?3);
sh_map.addpath_2(C?E?4);
sh_map.addpath_2(C?D?45);
sh_map.addpath_2(C?F?16);
Jframe?guide?=?new?Jframe();
guide.setSize(600600);
Container?pane?=?guide.getContentPane();
pane.setLayout(null);
ImageIcon?homeimg?=?new?ImageIcon(“image\\qlsc.gif“);
JLabel?back?=?new?JLabel(homeimg);
guide.getlayeredPane().add(back?new?Integer(Integer.MIN_VALUE));
back.setBounds(0?0?homeimg.getIconWidth()?homeimg.getIconHeight());
JLabel?welcom?=?new?JLabel(“山大軟件園校區歡迎您“);
welcom.setFont(font2);
welcom.setBounds(1101040040);
JButton?view_all?=?new?JButton(“所有景點一覽“);
view_all.setFont(font1);
view_all.addActionListener(this);
JTextField?jt_add_viw?=?new?JTextField();
JButton?add?=?new?JButton(“增加新的景點“);
add.setFont(font1);
add.addActionListener(this);
JTextField?jt_del_view?=?new?JTextField();
JButton?delete?=?new?JButton(“刪除已有景點“);
delete.setFont(font1);
delete.addActionListener(this);
JButton?view_sigle?=?new?JButton(“查看“);
view_sigle.setFont(font1);
view_sigle.addActionListener(this);
JButton?del?=?new?JButton(“刪除“);
del.setFont(font1);
del.addActionListener(this);
JButton?path_all?=?new?JButton(“查看所有路徑“);
path_all.setFont(font1);
path_all.addActionListener(this);
JLabel?to?=?new
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-07-05?10:40??數據結構-校園導游\
?????目錄???????????0??2013-07-05?10:39??數據結構-校園導游\源碼\
?????目錄???????????0??2013-07-05?10:39??數據結構-校園導游\源碼\DateStructure-SchoolGuide\
?????文件?????????301??2013-04-12?11:21??數據結構-校園導游\源碼\DateStructure-SchoolGuide\.classpath
?????文件?????????401??2013-04-12?11:21??數據結構-校園導游\源碼\DateStructure-SchoolGuide\.project
?????目錄???????????0??2013-07-05?10:39??數據結構-校園導游\源碼\DateStructure-SchoolGuide\.settings\
?????文件?????????598??2013-04-12?11:21??數據結構-校園導游\源碼\DateStructure-SchoolGuide\.settings\org.eclipse.jdt.core.prefs
?????目錄???????????0??2013-07-05?10:39??數據結構-校園導游\源碼\DateStructure-SchoolGuide\bin\
?????文件????????7681??2013-04-21?21:13??數據結構-校園導游\源碼\DateStructure-SchoolGuide\bin\Main.class
?????文件?????????738??2013-04-23?22:15??數據結構-校園導游\源碼\DateStructure-SchoolGuide\bin\Node.class
?????文件?????????878??2013-04-21?21:01??數據結構-校園導游\源碼\DateStructure-SchoolGuide\bin\Path.class
?????文件????????6635??2013-04-21?21:13??數據結構-校園導游\源碼\DateStructure-SchoolGuide\bin\SchoolMap.class
?????文件?????????836??2013-04-21?21:04??數據結構-校園導游\源碼\DateStructure-SchoolGuide\bin\TempPath.class
?????目錄???????????0??2013-07-05?10:39??數據結構-校園導游\源碼\DateStructure-SchoolGuide\image\
?????文件??????217877??2013-04-16?16:35??數據結構-校園導游\源碼\DateStructure-SchoolGuide\image\qlsc.gif
?????目錄???????????0??2013-07-05?10:39??數據結構-校園導游\源碼\DateStructure-SchoolGuide\src\
?????文件????????7196??2013-04-21?21:13??數據結構-校園導游\源碼\DateStructure-SchoolGuide\src\Main.java
?????文件?????????247??2013-04-23?22:15??數據結構-校園導游\源碼\DateStructure-SchoolGuide\src\Node.java
?????文件?????????292??2013-04-21?21:01??數據結構-校園導游\源碼\DateStructure-SchoolGuide\src\Path.java
?????文件????????5408??2013-04-21?21:13??數據結構-校園導游\源碼\DateStructure-SchoolGuide\src\SchoolMap.java
?????文件?????????244??2013-04-21?21:04??數據結構-校園導游\源碼\DateStructure-SchoolGuide\src\TempPath.java
?????文件???????44032??2013-04-23?22:37??數據結構-校園導游\設計報告.doc
- 上一篇:Machine learning DecisionTree
- 下一篇:航空售票系統
評論
共有 條評論