sxjy
发贴: 17
积分: 0
|
于 2004-12-12 14:57
这个程序的编译结果是什么意思啊?没有出现错误,但是运行不出来啊。[/color]
编译结果:
载入:找不到类 Fwindow.class。 java.lang.ClassNotFoundException: Fwindow.class at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:162) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:566) at sun.applet.AppletPanel.createApplet(AppletPanel.java:617) at sun.applet.AppletPanel.runLoader(AppletPanel.java:546) at sun.applet.AppletPanel.run(AppletPanel.java:298) at java.lang.Thread.run(Thread.java:534) Caused by: java.io.FileNotFoundException: C:\Java\Fwindow\class.class (系统找不到指定的路径。) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:106) at java.io.FileInputStream.<init>(FileInputStream.java:66) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:69) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:156) at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:274) at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:43) at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:152) at java.security.AccessController.doPrivileged(Native Method) at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:149) ... 8 more Exit code: 0 No Errors
源程序程序代码:
import java.awt.*; import java.awt.event.*; import java.applet.*;
class Fwindow extends Frame implements ActionListener { MenuBar menubar; Sumdialog sumdialog; Menu menu1; MenuItem item1,item2; Fwindow(String s) { super(s); setLayout(new GridLayout(1,1)); setSize(300,300); setBackground(Color.white); setVisible(false); menubar=new MenuBar(); menu1=new Menu("工具"); item1=new MenuItem("打开求和对话框"); item2=new MenuItem("关闭求和对话框"); item1.addActionListener(this); item2.addActionListener(this); menu1.add(item1); menu1.add(item2); menubar.add(menu1); setMenuBar(menubar); sumdialog=new Sumdialog(this,"求和对话框",false); } public void actionPerformed(ActionEvent e) { if(e.getSource()==item1) sumdialog.setVisible(true); else if(e.getSource()==item2) sumdialog.setVisible(false); } } class Sumdialog extends Dialog implements ActionListener { Button button; TextField text1,text2,text3; Label label1,label2; GridLayout net; Sumdialog(Frame F,String s,boolean p) { super(F,s,p); button=new Button("确定"); text1=new TextField(10); text2=new TextField(10); text3=new TextField(10); label1=new Label("输入加数"); label2=new Label("输入加数"); net=new GridLayout(3,2); setLayout(net); setSize(150,150); setVisible(false); setModal(false); add(label1);add(text1); add(label2);add(text2); add(button);add(text3); button.addActionListener(this); } public void actionPerformed(ActionEvent e) { float x; if(e.getSource()==button) { float a,b; a=Float.valueOf(text1.getText()).floatValue(); b=Float.valueOf(text2.getText()).floatValue(); x=a+b; text3.setText(String.valueOf(x)); } } } public class E33 extends Applet implements ActionListener { Fwindow window; Button button1,button2; public void init() { window=new Fwindow("工具窗口"); button1=new Button("打开窗口"); button2=new Button("关闭窗口"); add(button1);add(button2); button1.addActionListener(this); button2.addActionListener(this); } public void actionPerformed(ActionEvent e) { if(e.getSource()==button1) window.setVisible(true); else if(e.getSource()==button2) window.setVisible(false); } }
littledeer1974 edited on 2004-12-14 09:25
|