RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
java怎么实现窗口跳转

这篇文章将为大家详细讲解有关java怎么实现窗口跳转,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

为玉树等地区用户提供了全套网页设计制作服务,及玉树网站建设行业解决方案。主营业务为网站设计制作、成都做网站、玉树网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

假如有两个frame,分别为frame1,frame2,frame1加个按钮实现跳转.frame1代码如下
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;

public class frame1 extends JFrame implements ActionListener{

/**
* @param args
*/
private JButton jb;
public frame1()
{
this.setSize(300, 200);
this.setLocation(300, 400);
jb=new JButton("跳转");
this.add(jb);
jb.addActionListener(this);//加入事件监听
this.setVisible(true);

}
public static void main(String[] args) {
// TODO Auto-generated method stub
frame1 frame=new frame1();

}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==jb)
{
this.dispose();//点击按钮时frame1销毁,new一个frame2
new frame2();
}
}

}

frame2是个单纯的界面
import javax.swing.JButton;
import javax.swing.JFrame;

public class frame2 extends JFrame{

/**
* @param args
*/
public frame2()
{

this.setSize(300, 200);
this.setLocation(300, 400);

this.setVisible(true);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
frame2 frame=new frame2();
}

}

关于“java怎么实现窗口跳转”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。


分享题目:java怎么实现窗口跳转
地址分享:http://scyingshan.cn/article/ghhopc.html