import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import javax.swing.*;
import java.awt.image.*;
import java.util.*;
public class 显示 extends JFrame implements ActionListener,MouseListener {
MessagePanel messagePanel;
Button bt1,bt2,bt3,bt4;
int x0,y0;
int x1,y1;
int x,y;
int te[]=new int[20];
int temp[][]=new int[20][2];
int t;
public 显示(String s)
{
super(s);
Container contentPane=getContentPane();
contentPane.setLayout(new BorderLayout());
messagePanel =new MessagePanel();
messagePanel.setBorder(BorderFactory.createTitledBorder("黑大校园,包括,地下通道,3,4号楼,喷泉,篮球场,青楼,艺术楼,游泳馆,留学生公寓,食堂,C17,体育场"));
messagePanel.setFont(new Font("",Font.BOLD,35));
contentPane.add(messagePanel,BorderLayout.CENTER);
JPanel btpanel=new JPanel();
btpanel.setLayout(new FlowLayout());
bt1=new Button("起始点");
btpanel.add(bt1);
bt1.addActionListener(this);
bt2=new Button("终止点");
btpanel.add(bt2);
bt2.addActionListener(this);
bt3=new Button("确定");
btpanel.add(bt3);
bt3.addActionListener(this);
bt4=new Button("结束");
btpanel.add(bt4);
bt4.addActionListener(this);
contentPane.add(btpanel,BorderLayout.SOUTH);
this.pack();
this.setVisible(true);
addMouseListener(this);
}
public static void main(String[] args)
{
显示 a=new 显示("欢迎");
}
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
x=e.getX(); y=e.getY();
if(x>=43 && x<=67 && y>=484 && y<=551)
{
地下 b=new 地下("必经之路");
}
if(x>=55 && x<=195 && y>=394 && y<=482)
{
四号楼 b=new 四号楼("编程主要来这哦--");
}
if(x>=78 && x<=187 && y>=569 && y<=635)
{
三号楼 a=new 三号楼("这里是读书自习的主要去处");
}
if(x>=388 && x<=617 && y>=540 && y<=641)
{
游泳馆 c=new 游泳馆("休息放松的好去处");
}
if(x>=588 && x<=646 && y>=435 && y<=592)
{
艺术楼 d=new 艺术楼("我劝天公重抖擞,不拘一格降人才");
}
if(x>=824 && x<=892 && y>=456 && y<=594)
{
留学生 h =new 留学生("欢迎外面的朋友,相聚一堂");
}
if(x>=851 && x<=936 && y>=311 && y<=411)
{
食堂 f=new 食堂("管饭--");
}
if(x>=79 && x<=182 && y>=494 && y<=543)
{
喷泉 g=new 喷泉("喷泉,清凉,美丽");
}
if(x>=223 && x<=332 && y>=404 && y<=474)
{
篮球场 h=new 篮球场("英姿飒爽,青春飞扬");
}
if(x>=356 && x<=577 && y>=399 && y<=473)
{
青楼 h=new 青楼("计软学长们的家");
}
if(x>=960 && x<=1095 && y>=320 && y<=402)
{
C17 k=new C17("我的家");
}
if(x>=906 && x<=1119 && y>=636 && y<=724)
{
运动场 l=new 运动场("情侣约会的好地方哦");
}
}
@Override
public void mouseEntered(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==bt1)
{
x0=x;y0=y;
}
if(e.getSource()==bt2)
{
x1=x;y1=y;
}
if(e.getSource()==bt3)
{
路径 w=new 路径();
w.date(x0, y0, x1, y1);
w.dis(w.getend());
/*System.out.println(w.getend());*/
int hh;
for(hh=w.start,t=0;hh!=w.getend();hh=w.close[hh],t++)
te[t]=hh;
te[t]=w.getend();
for(int r=0;r<=t;r++)
{
if(te[r]==1){ temp[r][0]=44;temp[r][1]=487;}
if(te[r]==2){ temp[r][0]=133;temp[r][1]=448;}
if(te[r]==3){ temp[r][0]=128;temp[r][1]=527;}
if(te[r]==4){ temp[r][0]=339;temp[r][1]=459;}
if(te[r]==5){ temp[r][0]=345;temp[r][1]=501;}
if(te[r]==6){ temp[r][0]=371;temp[r][1]=488;}
if(te[r]==7){ temp[r][0]=487;temp[r][1]=488;}
if(te[r]==8){ temp[r][0]=476;temp[r][1]=496;}
if(te[r]==9){ temp[r][0]=591;temp[r][1]=486;}
if(te[r]==10){ temp[r][0]=737;temp[r][1]=490;}
if(te[r]==11){ temp[r][0]=841;temp[r][1]=427;}
if(te[r]==12){ temp[r][0]=936;temp[r][1]=381;}
if(te[r]==13){ temp[r][0]=871;temp[r][1]=467;}
if(te[r]==14){ temp[r][0]=130;temp[r][1]=488;}
if(te[r]==15){ temp[r][0]=280;temp[r][1]=409;}
if(te[r]==16){ temp[r][0]=466;temp[r][1]=412;}
if(te[r]==17){ temp[r][0]=950;temp[r][1]=627;}
if(te[r]==18){ temp[r][0]=941;temp[r][1]=366;}
}
messagePanel.setPoint(temp,t);
for(int r=0;r<=t;r++)
System.out.println(temp[r][0]+" "+temp[r][1]);
for(int r=0;r<=t;r++)
System.out.print(te[r]+" ");
messagePanel.repaint();
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录





















































共 48 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10








资源评论

- qq_390969622018-06-21每个景点写了一个类,非常乱,还打不开,完全无用
- PBB0xFF2018-06-19效果还不错
- qq_415473012018-04-17效果很好,谢谢
跟SEI整景呢
- 粉丝: 6
- 资源: 13

上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
已下载
下载帮助

看过该资源的人还看了
内容简介:校园导航.rar 校园导航 校园导航 .project src .settings .classpath bin
安全验证
文档复制为VIP权益,开通VIP直接复制
