如何制作如下的java程序,帮一下撒!(50分) 同意楼上!<<java21天自学通>><<java技术内幕〉 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 /***NewWindow.java*/import java.awt.*;import java.awt.event.*;import javax.swing.*;public class NewWindow extends JFrame implements ActionListener { private JButton next; JPanel pane; public NewWindow() { super("Window"); setSize(300,500); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); next = JButton("下一步"); pane = new JPanel(); pane.addActionListener(this); pane.add(next); setContentPane(pane); } public static void main(String[] args) { NewWindow window = new NewWindow(); window.show(); } public void actionPerformed(ActionEvent evt) { new NewWindow(); //你可以试试生成自身对像. } } 也可以再做一个类似的类然后生成本类对像就可以,当然你这个类具有其它一些别的功能感觉好像是在做一个向导之类的东西。我在网吧上网 没有调试运行有错与我联系给我发短信。 在第一个Jframe的下一步按钮的监听中new第二个Jframe,在第二个Jframe的下一步按钮的监听中new第三个Jframe,以此类推,但是不能关闭前一个窗口要注意的是一定不能system.exit(0),这个是把整个程序都关闭的命令,可以在第二三四个JFrame中不加入system.exit(0),这样关闭当前窗口的时候就不会把整个程序关闭了这样不行吗????? 上个帖子不是给你写了吗?你看了不是你要的效果?再贴一下,否则白写了,哈哈,抢分无极限import javax.swing.*;import java.awt.*;import javax.swing.event.*;import java.awt.event.*;public class Test extends JFrame{ JButton a; static Test frame; public Test(){ Container cp = getContentPane(); a = new JButton("µÚÒ»²½"); a.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ Text2 frame2 = new Text2(); frame2.setVisible(true); frame2.setSize(200,200); frame2.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); } }); frame.setVisible(false); } }); cp.add(a); pack(); repaint(); } public static void main(String[] args){ frame = new Test(); frame.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); } }); frame.setSize(200,200); frame.setVisible(true); }}class Text2 extends JFrame{ JButton a ; public Text2(){ Container cp = getContentPane(); a = new JButton("µÚ¶þ²½"); cp.add(a); pack(); repaint(); }} 求助,java网站用户登陆后持久在线的思路。 java图片问题 文件读写操作问题 GBK 转 UTF-8问题 请问在哪里可以下载HP UX的java jdk? double计算小数点后的值不对,请看看那里的问题 byte[] 到float的转换问题!急!!! protected 与 package 的存取权限怎么在我看来是一样的? 关于本地方法调用问题 一个关于main()的问题? 请帮忙看看我的这个程序 ResultSet里读出数据的参数问题,马上给分
*NewWindow.java
*/import java.awt.*;
import java.awt.event.*;
import javax.swing.*;public class NewWindow extends JFrame implements ActionListener
{
private JButton next;
JPanel pane;
public NewWindow()
{
super("Window");
setSize(300,500);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
next = JButton("下一步");
pane = new JPanel();
pane.addActionListener(this);
pane.add(next);
setContentPane(pane);
}
public static void main(String[] args)
{
NewWindow window = new NewWindow();
window.show();
}
public void actionPerformed(ActionEvent evt)
{
new NewWindow(); //你可以试试生成自身对像.
}
}
也可以再做一个类似的类然后生成本类对像就可以,
当然你这个类具有其它一些别的功能感觉好像是在做一个向导之类的东西。我在网吧上网 没有调试运行有错与我联系给我发短信。
要注意的是一定不能system.exit(0),这个是把整个程序都关闭的命令,可以在第二三四个JFrame中不加入system.exit(0),这样关闭当前窗口的时候就不会把整个程序关闭了
这样不行吗?????
import java.awt.*;
import javax.swing.event.*;
import java.awt.event.*;public class Test extends JFrame{
JButton a;
static Test frame;
public Test(){
Container cp = getContentPane();
a = new JButton("µÚÒ»²½");
a.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
Text2 frame2 = new Text2();
frame2.setVisible(true);
frame2.setSize(200,200);
frame2.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
}); frame.setVisible(false);
}
});
cp.add(a);
pack();
repaint();
} public static void main(String[] args){
frame = new Test();
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
frame.setSize(200,200);
frame.setVisible(true);
}
}class Text2 extends JFrame{
JButton a ;
public Text2(){
Container cp = getContentPane();
a = new JButton("µÚ¶þ²½");
cp.add(a);
pack();
repaint();
}
}