发你的Applet给我看看,太有意思了。[email protected]

解决方案 »

  1.   

    这是主类的源码,其他的先不贴了.
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.util.*;
    import javax.swing.*;
    import java.io.*;public class Sketcher extends Applet {
      private boolean isStandalone = false;
      private SketchModel sketch;
      private SketchView view;
      private static SketchFrame window;
      private static Sketcher app;
            //private static JDialog chatDialog;
      private static int proID=0;
      private  int thisProID=0;
      //Get a parameter value
      public String getParameter(String key, String def) {
        return isStandalone ? System.getProperty(key, def) :
          (getParameter(key) != null ? getParameter(key) : def);
      }  //Construct the applet
      public Sketcher() {
      }
      //Initialize the applet
      public void init() {
        try {
          jbInit();
        }
        catch(Exception e) {
          e.printStackTrace();
        }
      }
      //Component initialization
      private void jbInit() throws Exception {    window = new SketchFrame("画图", this);    // Create the app window
    Toolkit theKit = window.getToolkit();          // Get the window toolkit
    Dimension wndSize = theKit.getScreenSize();    // Get screen size// Set the position to screen center & size to 2/3 screen size
    window.setBounds(wndSize.width/6, wndSize.height/6,        // Position
                 4*wndSize.width/5, 4*wndSize.height/5);   // Sizewindow.addWindowListener(new WindowHandler()); // Add window listenersketch = new SketchModel();                 // Create the model
    view = new SketchView(this);                // Create the view
    sketch.addObserver((Observer)view);         // Register the view with the model
    sketch.addObserver((Observer)window);       // Register window as observer
    window.getContentPane().add(view, BorderLayout.CENTER);
    window.setVisible(true);
    Sketcher.proID++;
    thisProID=Sketcher.proID;
      }  public SketchFrame getWindow(){
                    return window;
            }        public SketchModel getModel(){
                    return sketch;
            }        public int getProID(){
                    return thisProID;
            }        public SketchView getView(){
                    return view;
            }        /*public JDialog getDlg(){
                    return chatDialog;
            }*/
            public void insertModel(SketchModel newSketch){
                    sketch=newSketch;
                    sketch.addObserver((Observer)view);
                    sketch.addObserver((Observer)window);
                    view.repaint();
            }
            class WindowHandler extends WindowAdapter{
                    public void windowClosing(WindowEvent e){
                            window.checkForSave();
                            System.exit(0);                }
    }
      //Get Applet information
      public String getAppletInfo() {
        return "Applet Information";
      }
      //Get parameter info
      public String[][] getParameterInfo() {
        return null;
      }
    }
    这是Html<html>
    <head>
    <title>
    draw
    </title>
    </head><body>
    <APPLET
      CODEBASE = "."
      CODE     = "Sketcher.class"
      ARCHIVE  = "MyApplet.jar"
      NAME     = "TestApplet"
      HEIGHT   = "600"
      WIDTH    = "1024"
      HSPACE   = 0
      VSPACE   = 0
      ALIGN    = top
    >
    </APPLET></body>
    </html>
      

  2.   

    根本编译不过啊,SketchModel 类没有啊
      

  3.   

    你用非Java也会出现类似问题,操作系统会检测软驱(和BIOS设置有关的),具体位置因为在公司不能进BIOS指出.
      

  4.   

    顺便问下,如何通过applet来检查软驱?
      

  5.   

    applet  安全特性不应该检查软驱吧
      

  6.   

    那到有可能,这样就不是applet机制的问题了。
      

  7.   

    比较诡异!
    莫非是中了邪(病毒)?
    将全部的源码放到一台新机器上重新编译来过。
    然后在新机器上测试,应该不会有这样问题的。
    然后search全部源码,检查是否有a:\\字样。
    out部分是否写入了软驱。
    呵呵,这样就搞定了。至少可以找出原因了。
    ----------------------
    不过到现在我还是觉得这种情况不可能发生!