使用旧实例

时间:2015-11-05 00:27:49

标签: java swing

我使用swing在java中制作骰子滚动程序。我有4节课:

public class Die{
private int faceValue;

public Die(){
    System.out.println("Creating new Dice Object");
    setValue(roll());
}

public int roll() {
    int val = (int) (6 * Math.random() + 1);
    setValue(val);
    return val;
}

public int getValue() {
    return faceValue;
}

public void setValue(int spots) {
    faceValue = spots;
}
}

DieFace

public class DieFace {
private int spotDiam,wOffset,hOffset,w,h;
public int faceValue;

public DieFace(){
    Die die = new Die();
    this.faceValue = die.getValue();
}

public void draw(Graphics g, int paneWidth, int paneHeight){
    //draw information
}
}

DieFaceComponent

public class DieFaceComponent extends JComponent{
private static final long serialVersionUID = 1L;

DieFace face; 

public DieFaceComponent(){
    face = new DieFace();
    System.out.println("DIEFACE" + face.faceValue);
    repaint();
}

public void paintComponent(Graphics g){
    revalidate();
    face.draw(g,super.getWidth(),super.getHeight());  

}
}

DieFaceViewer

public class DieFaceViewer{

static DieFaceComponent component;
static JFrame frame = new JFrame(); // Create a new JFrame object

public static void main(String[] args){
    final int FRAME_WIDTH = 500;
    final int FRAME_HEIGHT = 500;
    frame.setSize(FRAME_WIDTH, FRAME_HEIGHT); // Set initial size 
    frame.setTitle("Dice Simulator Version 1.0"); // Set title
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Set default close operation
    component = new DieFaceComponent(); // Create a new DieFaceComponent object
    frame.setLayout(new BorderLayout());
    JButton btnRoll = new JButton("Roll!");
    btnRoll.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            component = new DieFaceComponent();
        }
    });

    frame.add(component, BorderLayout.CENTER); // Add DieFaceComponent object to frame
    frame.add(btnRoll, BorderLayout.SOUTH);
    frame.setVisible(true); // Set frame to visible
}
}

我的问题是,即使每次按下我的btnRoll时都会创建一个新的Die,DieFace和DieFaceComponent对象,用于绘制组件的值与初始实例保持一致。我做错了吗?提前致谢

1 个答案:

答案 0 :(得分:2)

您在DieFaceComponent中创建了ActionListener的新实例,但对其执行了任何操作,它从未添加到任何内容中,因此它永远不可见。一个更好的解决方案可以让您触发对DieFaceComponent的更改,从而触发对DieFace的更改,该更改触发了对Die的更改并让整个事情只有repaint本身,例如......

public class Die {

    private int faceValue;

    public Die() {
        System.out.println("Creating new Dice Object");
        //setValue(roll());
        roll(); // Roll sets the value any way :P
    }

    public int roll() {
        int val = (int) (6 * Math.random() + 1);
        setValue(val);
        return val;
    }

    public int getValue() {
        return faceValue;
    }

    public void setValue(int spots) {
        faceValue = spots;
    }
}

public class DieFace {

    private int spotDiam, wOffset, hOffset, w, h;
    //public int faceValue;
    private Die die;

    public DieFace() {
        die = new Die();
        //Die die = new Die();
        // This is pointless, as you should simply as die for it's value
        // when ever you need it...
        //this.faceValue = die.getValue();
    }

    public void roll() {
        die.roll();
    }

    public void draw(Graphics g, int paneWidth, int paneHeight) {
        //draw information
    }
}

public class DieFaceComponent extends JComponent {

    private static final long serialVersionUID = 1L;

    DieFace face;

    public DieFaceComponent() {
        face = new DieFace();
        //System.out.println("DIEFACE" + face.faceValue);
        // Pointless, as you've probably not actually been added to anything
        // that could actuallyt paint you anyway...
        //repaint();
    }

    public void roll() {
        face.roll();
        repaint();
    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        //revalidate();
        face.draw(g, super.getWidth(), super.getHeight());

    }
}

现在,您可以在roll上拨打DieFaceComponentroll会在DieFace上拨打rollDie会在DieFaceComponent上拨打repaint,将更新实际值。然后import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class DiceRoller { public static void main(String[] args) { new DiceRoller(); } public DiceRoller() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new DiePane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class DiePane extends JPanel { public DiePane() { setLayout(new BorderLayout()); DieFaceComponent component = new DieFaceComponent(); JButton roll = new JButton("Roll"); roll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { component.roll(); } }); add(component); add(roll, BorderLayout.SOUTH); } @Override public Dimension getPreferredSize() { return new Dimension(200, 200); } } } 会安排Die以确保它在屏幕上更新。

然后你可以使用类似......

的东西
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class DiceRoller {

    public static void main(String[] args) {
        new DiceRoller();
    }

    public DiceRoller() {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
                    ex.printStackTrace();
                }

                JFrame frame = new JFrame("Testing");
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.add(new DiePane());
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setVisible(true);
            }
        });
    }

    public class DiePane extends JPanel {

        public DiePane() {
            setLayout(new BorderLayout());

            Die die = new Die();
            DieFaceComponent component = new DieFaceComponent(die);
            JButton roll = new JButton("Roll");
            roll.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    die.roll();
                }
            });
            add(component);
            add(roll, BorderLayout.SOUTH);
        }

        @Override
        public Dimension getPreferredSize() {
            return new Dimension(200, 200);
        }

        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2d = (Graphics2D) g.create();
            g2d.dispose();
        }

    }

    public class Die {

        private PropertyChangeSupport propertyChangeSupport;
        private int faceValue;

        public Die() {
            propertyChangeSupport = new PropertyChangeSupport(this);
            System.out.println("Creating new Dice Object");
            //setValue(roll());
            roll(); // Roll sets the value any way :P
        }

        public int roll() {
            int val = (int) (6 * Math.random() + 1);
            setValue(val);
            return val;
        }

        public int getValue() {
            return faceValue;
        }

        public void setValue(int spots) {
            int old = faceValue;
            faceValue = spots;
            propertyChangeSupport.firePropertyChange("value", old, faceValue);
        }

        public void addPropertyChangeListener(PropertyChangeListener listener) {
            propertyChangeSupport.addPropertyChangeListener(listener);
        }

        public void removePropertyChangeListener(PropertyChangeListener listener) {
            propertyChangeSupport.addPropertyChangeListener(listener);
        }
    }

    public class DieFace {

        private int spotDiam, wOffset, hOffset, w, h;
        private Die die;

        public DieFace(Die die) {
            this.die = die
        }

        public void draw(Graphics g, int paneWidth, int paneHeight) {
            //draw information
        }
    }

    public class DieFaceComponent extends JComponent {

        private static final long serialVersionUID = 1L;

        private DieFace face;

        public DieFaceComponent(Die die) {
            face = new DieFace(die);
            die.addPropertyChangeListener(new PropertyChangeListener() {
                @Override
                public void propertyChange(PropertyChangeEvent evt) {
                    repaint();
                }
            });
        }

        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            //revalidate();
            face.draw(g, super.getWidth(), super.getHeight());

        }
    }

}

现在,更好的解决方案是将Die作为主要入口点,允许它向感兴趣的各方生成通知并让他们自己更新

也许像......

<div>
<?php
   echo nl2br(file_get_contents(path_to_your_file));
?>
</div>

这是一个Observer Pattern的简单示例,其中 <staticContent lockAttributes="isDocFooterFileName"> <mimeMap fileExtension=".323" mimeType="text/h323" /> <mimeMap fileExtension=".3g2" mimeType="video/3gpp2" /> <mimeMap fileExtension=".3gp2" mimeType="video/3gpp2" /> <mimeMap fileExtension=".3gp" mimeType="video/3gpp" /> <mimeMap fileExtension=".3gpp" mimeType="video/3gpp" /> <mimeMap fileExtension=".aaf" mimeType="application/octet-stream" /> <mimeMap fileExtension=".aac" mimeType="audio/aac" /> <mimeMap fileExtension=".aca" mimeType="application/octet-stream" /> <mimeMap fileExtension=".accdb" mimeType="application/msaccess" /> <mimeMap fileExtension=".accde" mimeType="application/msaccess" /> <mimeMap fileExtension=".accdt" mimeType="application/msaccess" /> <mimeMap fileExtension=".acx" mimeType="application/internet-property-stream" /> <mimeMap fileExtension=".adt" mimeType="audio/vnd.dlna.adts" /> <mimeMap fileExtension=".adts" mimeType="audio/vnd.dlna.adts" /> <mimeMap fileExtension=".afm" mimeType="application/octet-stream" /> <mimeMap fileExtension=".ai" mimeType="application/postscript" /> <mimeMap fileExtension=".aif" mimeType="audio/x-aiff" /> <mimeMap fileExtension=".aifc" mimeType="audio/aiff" /> <mimeMap fileExtension=".aiff" mimeType="audio/aiff" /> <mimeMap fileExtension=".application" mimeType="application/x-ms-application" /> <mimeMap fileExtension=".art" mimeType="image/x-jg" /> <mimeMap fileExtension=".asd" mimeType="application/octet-stream" /> <mimeMap fileExtension=".asf" mimeType="video/x-ms-asf" /> <mimeMap fileExtension=".asi" mimeType="application/octet-stream" /> <mimeMap fileExtension=".asm" mimeType="text/plain" /> <mimeMap fileExtension=".asr" mimeType="video/x-ms-asf" /> <mimeMap fileExtension=".asx" mimeType="video/x-ms-asf" /> <mimeMap fileExtension=".atom" mimeType="application/atom+xml" /> <mimeMap fileExtension=".au" mimeType="audio/basic" /> <mimeMap fileExtension=".avi" mimeType="video/avi" /> <mimeMap fileExtension=".axs" mimeType="application/olescript" /> <mimeMap fileExtension=".bas" mimeType="text/plain" /> <mimeMap fileExtension=".bcpio" mimeType="application/x-bcpio" /> <mimeMap fileExtension=".bin" mimeType="application/octet-stream" /> <mimeMap fileExtension=".bmp" mimeType="image/bmp" /> <mimeMap fileExtension=".c" mimeType="text/plain" /> <mimeMap fileExtension=".cab" mimeType="application/vnd.ms-cab-compressed" /> <mimeMap fileExtension=".calx" mimeType="application/vnd.ms-office.calx" /> <mimeMap fileExtension=".cat" mimeType="application/vnd.ms-pki.seccat" /> <mimeMap fileExtension=".cdf" mimeType="application/x-cdf" /> <mimeMap fileExtension=".chm" mimeType="application/octet-stream" /> <mimeMap fileExtension=".class" mimeType="application/x-java-applet" /> <mimeMap fileExtension=".clp" mimeType="application/x-msclip" /> <mimeMap fileExtension=".cmx" mimeType="image/x-cmx" /> <mimeMap fileExtension=".cnf" mimeType="text/plain" /> <mimeMap fileExtension=".cod" mimeType="image/cis-cod" /> <mimeMap fileExtension=".cpio" mimeType="application/x-cpio" /> <mimeMap fileExtension=".cpp" mimeType="text/plain" /> <mimeMap fileExtension=".crd" mimeType="application/x-mscardfile" /> <mimeMap fileExtension=".crl" mimeType="application/pkix-crl" /> <mimeMap fileExtension=".crt" mimeType="application/x-x509-ca-cert" /> <mimeMap fileExtension=".csh" mimeType="application/x-csh" /> <mimeMap fileExtension=".css" mimeType="text/css" /> <mimeMap fileExtension=".csv" mimeType="application/octet-stream" /> <mimeMap fileExtension=".cur" mimeType="application/octet-stream" /> <mimeMap fileExtension=".dcr" mimeType="application/x-director" /> <mimeMap fileExtension=".deploy" mimeType="application/octet-stream" /> <mimeMap fileExtension=".der" mimeType="application/x-x509-ca-cert" /> <mimeMap fileExtension=".dib" mimeType="image/bmp" /> <mimeMap fileExtension=".dir" mimeType="application/x-director" /> <mimeMap fileExtension=".disco" mimeType="text/xml" /> <mimeMap fileExtension=".dll" mimeType="application/x-msdownload" /> <mimeMap fileExtension=".dll.config" mimeType="text/xml" /> <mimeMap fileExtension=".dlm" mimeType="text/dlm" /> <mimeMap fileExtension=".doc" mimeType="application/msword" /> <mimeMap fileExtension=".docm" mimeType="application/vnd.ms-word.document.macroEnabled.12" /> <mimeMap fileExtension=".docx" mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.document" /> <mimeMap fileExtension=".dot" mimeType="application/msword" /> <mimeMap fileExtension=".dotm" mimeType="application/vnd.ms-word.template.macroEnabled.12" /> <mimeMap fileExtension=".dotx" mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.template" /> <mimeMap fileExtension=".dsp" mimeType="application/octet-stream" /> <mimeMap fileExtension=".dtd" mimeType="text/xml" /> <mimeMap fileExtension=".dvi" mimeType="application/x-dvi" /> <mimeMap fileExtension=".dvr-ms" mimeType="video/x-ms-dvr" /> <mimeMap fileExtension=".dwf" mimeType="drawing/x-dwf" /> <mimeMap fileExtension=".dwp" mimeType="application/octet-stream" /> <mimeMap fileExtension=".dxr" mimeType="application/x-director" /> <mimeMap fileExtension=".eml" mimeType="message/rfc822" /> <mimeMap fileExtension=".emz" mimeType="application/octet-stream" /> <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" /> <mimeMap fileExtension=".eps" mimeType="application/postscript" /> <mimeMap fileExtension=".etx" mimeType="text/x-setext" /> <mimeMap fileExtension=".evy" mimeType="application/envoy" /> <mimeMap fileExtension=".exe" mimeType="application/octet-stream" /> <mimeMap fileExtension=".exe.config" mimeType="text/xml" /> <mimeMap fileExtension=".fdf" mimeType="application/vnd.fdf" /> <mimeMap fileExtension=".fif" mimeType="application/fractals" /> <mimeMap fileExtension=".fla" mimeType="application/octet-stream" /> <mimeMap fileExtension=".flr" mimeType="x-world/x-vrml" /> <mimeMap fileExtension=".flv" mimeType="video/x-flv" /> <mimeMap fileExtension=".gif" mimeType="image/gif" /> <mimeMap fileExtension=".gtar" mimeType="application/x-gtar" /> <mimeMap fileExtension=".gz" mimeType="application/x-gzip" /> <mimeMap fileExtension=".h" mimeType="text/plain" /> <mimeMap fileExtension=".hdf" mimeType="application/x-hdf" /> <mimeMap fileExtension=".hdml" mimeType="text/x-hdml" /> <mimeMap fileExtension=".hhc" mimeType="application/x-oleobject" /> <mimeMap fileExtension=".hhk" mimeType="application/octet-stream" /> <mimeMap fileExtension=".hhp" mimeType="application/octet-stream" /> <mimeMap fileExtension=".hlp" mimeType="application/winhlp" /> <mimeMap fileExtension=".hqx" mimeType="application/mac-binhex40" /> <mimeMap fileExtension=".hta" mimeType="application/hta" /> <mimeMap fileExtension=".htc" mimeType="text/x-component" /> <mimeMap fileExtension=".htm" mimeType="text/html" /> <mimeMap fileExtension=".html" mimeType="text/html" /> <mimeMap fileExtension=".htt" mimeType="text/webviewhtml" /> <mimeMap fileExtension=".hxt" mimeType="text/html" /> <mimeMap fileExtension=".ico" mimeType="image/x-icon" /> <mimeMap fileExtension=".ics" mimeType="text/calendar" /> <mimeMap fileExtension=".ief" mimeType="image/ief" /> <mimeMap fileExtension=".iii" mimeType="application/x-iphone" /> <mimeMap fileExtension=".inf" mimeType="application/octet-stream" /> <mimeMap fileExtension=".ins" mimeType="application/x-internet-signup" /> <mimeMap fileExtension=".isp" mimeType="application/x-internet-signup" /> <mimeMap fileExtension=".IVF" mimeType="video/x-ivf" /> <mimeMap fileExtension=".jar" mimeType="application/java-archive" /> <mimeMap fileExtension=".java" mimeType="application/octet-stream" /> <mimeMap fileExtension=".jck" mimeType="application/liquidmotion" /> <mimeMap fileExtension=".jcz" mimeType="application/liquidmotion" /> <mimeMap fileExtension=".jfif" mimeType="image/pjpeg" /> <mimeMap fileExtension=".jpb" mimeType="application/octet-stream" /> <mimeMap fileExtension=".jpe" mimeType="image/jpeg" /> <mimeMap fileExtension=".jpeg" mimeType="image/jpeg" /> <mimeMap fileExtension=".jpg" mimeType="image/jpeg" /> <mimeMap fileExtension=".js" mimeType="application/javascript" /> <mimeMap fileExtension=".json" mimeType="application/json" /> <mimeMap fileExtension=".jsx" mimeType="text/jscript" /> <mimeMap fileExtension=".latex" mimeType="application/x-latex" /> <mimeMap fileExtension=".lit" mimeType="application/x-ms-reader" /> <mimeMap fileExtension=".lpk" mimeType="application/octet-stream" /> <mimeMap fileExtension=".lsf" mimeType="video/x-la-asf" /> <mimeMap fileExtension=".lsx" mimeType="video/x-la-asf" /> <mimeMap fileExtension=".lzh" mimeType="application/octet-stream" /> <mimeMap fileExtension=".m13" mimeType="application/x-msmediaview" /> <mimeMap fileExtension=".m14" mimeType="application/x-msmediaview" /> <mimeMap fileExtension=".m1v" mimeType="video/mpeg" /> <mimeMap fileExtension=".m2ts" mimeType="video/vnd.dlna.mpeg-tts" /> <mimeMap fileExtension=".m3u" mimeType="audio/x-mpegurl" /> <mimeMap fileExtension=".m4a" mimeType="audio/mp4" /> <mimeMap fileExtension=".m4v" mimeType="video/mp4" /> <mimeMap fileExtension=".man" mimeType="application/x-troff-man" /> <mimeMap fileExtension=".manifest" mimeType="application/x-ms-manifest" /> <mimeMap fileExtension=".map" mimeType="text/plain" /> <mimeMap fileExtension=".mdb" mimeType="application/x-msaccess" /> <mimeMap fileExtension=".mdp" mimeType="application/octet-stream" /> <mimeMap fileExtension=".me" mimeType="application/x-troff-me" /> <mimeMap fileExtension=".mht" mimeType="message/rfc822" /> <mimeMap fileExtension=".mhtml" mimeType="message/rfc822" /> <mimeMap fileExtension=".mid" mimeType="audio/mid" /> <mimeMap fileExtension=".midi" mimeType="audio/mid" /> <mimeMap fileExtension=".mix" mimeType="application/octet-stream" /> <mimeMap fileExtension=".mmf" mimeType="application/x-smaf" /> <mimeMap fileExtension=".mno" mimeType="text/xml" /> <mimeMap fileExtension=".mny" mimeType="application/x-msmoney" /> <mimeMap fileExtension=".mov" mimeType="video/quicktime" /> <mimeMap fileExtension=".movie" mimeType="video/x-sgi-movie" /> <mimeMap fileExtension=".mp2" mimeType="video/mpeg" /> <mimeMap fileExtension=".mp3" mimeType="audio/mpeg" /> <mimeMap fileExtension=".mp4" mimeType="video/mp4" /> <mimeMap fileExtension=".mp4v" mimeType="video/mp4" /> <mimeMap fileExtension=".mpa" mimeType="video/mpeg" /> <mimeMap fileExtension=".mpe" mimeType="video/mpeg" /> <mimeMap fileExtension=".mpeg" mimeType="video/mpeg" /> <mimeMap fileExtension=".mpg" mimeType="video/mpeg" /> <mimeMap fileExtension=".mpp" mimeType="application/vnd.ms-project" /> <mimeMap fileExtension=".mpv2" mimeType="video/mpeg" /> <mimeMap fileExtension=".ms" mimeType="application/x-troff-ms" /> <mimeMap fileExtension=".msi" mimeType="application/octet-stream" /> <mimeMap fileExtension=".mso" mimeType="application/octet-stream" /> <mimeMap fileExtension=".mvb" mimeType="application/x-msmediaview" /> <mimeMap fileExtension=".mvc" mimeType="application/x-miva-compiled" /> <mimeMap fileExtension=".nc" mimeType="application/x-netcdf" /> <mimeMap fileExtension=".nsc" mimeType="video/x-ms-asf" /> <mimeMap fileExtension=".nws" mimeType="message/rfc822" /> <mimeMap fileExtension=".ocx" mimeType="application/octet-stream" /> <mimeMap fileExtension=".oda" mimeType="application/oda" /> <mimeMap fileExtension=".odc" mimeType="text/x-ms-odc" /> <mimeMap fileExtension=".ods" mimeType="application/oleobject" /> <mimeMap fileExtension=".oga" mimeType="audio/ogg" /> <mimeMap fileExtension=".ogg" mimeType="video/ogg" /> <mimeMap fileExtension=".ogv" mimeType="video/ogg" /> <mimeMap fileExtension=".one" mimeType="application/onenote" /> <mimeMap fileExtension=".onea" mimeType="application/onenote" /> <mimeMap fileExtension=".onetoc" mimeType="application/onenote" /> <mimeMap fileExtension=".onetoc2" mimeType="application/onenote" /> <mimeMap fileExtension=".onetmp" mimeType="application/onenote" /> <mimeMap fileExtension=".onepkg" mimeType="application/onenote" /> <mimeMap fileExtension=".osdx" mimeType="application/opensearchdescription+xml" /> <mimeMap fileExtension=".otf" mimeType="font/otf" /> <mimeMap fileExtension=".p10" mimeType="application/pkcs10" /> <mimeMap fileExtension=".p12" mimeType="application/x-pkcs12" /> <mimeMap fileExtension=".p7b" mimeType="application/x-pkcs7-certificates" /> <mimeMap fileExtension=".p7c" mimeType="application/pkcs7-mime" /> <mimeMap fileExtension=".p7m" mimeType="application/pkcs7-mime" /> <mimeMap fileExtension=".p7r" mimeType="application/x-pkcs7-certreqresp" /> <mimeMap fileExtension=".p7s" mimeType="application/pkcs7-signature" /> <mimeMap fileExtension=".pbm" mimeType="image/x-portable-bitmap" /> <mimeMap fileExtension=".pcx" mimeType="application/octet-stream" /> <mimeMap fileExtension=".pcz" mimeType="application/octet-stream" /> <mimeMap fileExtension=".pdf" mimeType="application/pdf" /> <mimeMap fileExtension=".pfb" mimeType="application/octet-stream" /> <mimeMap fileExtension=".pfm" mimeType="application/octet-stream" /> <mimeMap fileExtension=".pfx" mimeType="application/x-pkcs12" /> <mimeMap fileExtension=".pgm" mimeType="image/x-portable-graymap" /> <mimeMap fileExtension=".pko" mimeType="application/vnd.ms-pki.pko" /> <mimeMap fileExtension=".pma" mimeType="application/x-perfmon" /> <mimeMap fileExtension=".pmc" mimeType="application/x-perfmon" /> <mimeMap fileExtension=".pml" mimeType="application/x-perfmon" /> <mimeMap fileExtension=".pmr" mimeType="application/x-perfmon" /> <mimeMap fileExtension=".pmw" mimeType="application/x-perfmon" /> <mimeMap fileExtension=".png" mimeType="image/png" /> <mimeMap fileExtension=".pnm" mimeType="image/x-portable-anymap" /> <mimeMap fileExtension=".pnz" mimeType="image/png" /> <mimeMap fileExtension=".pot" mimeType="application/vnd.ms-powerpoint" /> <mimeMap fileExtension=".potm" mimeType="application/vnd.ms-powerpoint.template.macroEnabled.12" /> <mimeMap fileExtension=".potx" mimeType="application/vnd.openxmlformats-officedocument.presentationml.template" /> <mimeMap fileExtension=".ppam" mimeType="application/vnd.ms-powerpoint.addin.macroEnabled.12" /> <mimeMap fileExtension=".ppm" mimeType="image/x-portable-pixmap" /> <mimeMap fileExtension=".pps" mimeType="application/vnd.ms-powerpoint" /> <mimeMap fileExtension=".ppsm" mimeType="application/vnd.ms-powerpoint.slideshow.macroEnabled.12" /> <mimeMap fileExtension=".ppsx" mimeType="application/vnd.openxmlformats-officedocument.presentationml.slideshow" /> <mimeMap fileExtension=".ppt" mimeType="application/vnd.ms-powerpoint" /> <mimeMap fileExtension=".pptm" mimeType="application/vnd.ms-powerpoint.presentation.macroEnabled.12" /> <mimeMap fileExtension=".pptx" mimeType="application/vnd.openxmlformats-officedocument.presentationml.presentation" /> <mimeMap fileExtension=".prf" mimeType="application/pics-rules" /> <mimeMap fileExtension=".prm" mimeType="application/octet-stream" /> <mimeMap fileExtension=".prx" mimeType="application/octet-stream" /> <mimeMap fileExtension=".ps" mimeType="application/postscript" /> <mimeMap fileExtension=".psd" mimeType="application/octet-stream" /> <mimeMap fileExtension=".psm" mimeType="application/octet-stream" /> <mimeMap fileExtension=".psp" mimeType="application/octet-stream" /> <mimeMap fileExtension=".pub" mimeType="application/x-mspublisher" /> <mimeMap fileExtension=".qt" mimeType="video/quicktime" /> <mimeMap fileExtension=".qtl" mimeType="application/x-quicktimeplayer" /> <mimeMap fileExtension=".qxd" mimeType="application/octet-stream" /> <mimeMap fileExtension=".ra" mimeType="audio/x-pn-realaudio" /> <mimeMap fileExtension=".ram" mimeType="audio/x-pn-realaudio" /> <mimeMap fileExtension=".rar" mimeType="application/octet-stream" /> <mimeMap fileExtension=".ras" mimeType="image/x-cmu-raster" /> <mimeMap fileExtension=".rf" mimeType="image/vnd.rn-realflash" /> <mimeMap fileExtension=".rgb" mimeType="image/x-rgb" /> <mimeMap fileExtension=".rm" mimeType="application/vnd.rn-realmedia" /> <mimeMap fileExtension=".rmi" mimeType="audio/mid" /> <mimeMap fileExtension=".roff" mimeType="application/x-troff" /> <mimeMap fileExtension=".rpm" mimeType="audio/x-pn-realaudio-plugin" /> <mimeMap fileExtension=".rtf" mimeType="application/rtf" /> <mimeMap fileExtension=".rtx" mimeType="text/richtext" /> <mimeMap fileExtension=".scd" mimeType="application/x-msschedule" /> <mimeMap fileExtension=".sct" mimeType="text/scriptlet" /> <mimeMap fileExtension=".sea" mimeType="application/octet-stream" /> <mimeMap fileExtension=".setpay" mimeType="application/set-payment-initiation" /> <mimeMap fileExtension=".setreg" mimeType="application/set-registration-initiation" /> <mimeMap fileExtension=".sgml" mimeType="text/sgml" /> <mimeMap fileExtension=".sh" mimeType="application/x-sh" /> <mimeMap fileExtension=".shar" mimeType="application/x-shar" /> <mimeMap fileExtension=".sit" mimeType="application/x-stuffit" /> <mimeMap fileExtension=".sldm" mimeType="application/vnd.ms-powerpoint.slide.macroEnabled.12" /> <mimeMap fileExtension=".sldx" mimeType="application/vnd.openxmlformats-officedocument.presentationml.slide" /> <mimeMap fileExtension=".smd" mimeType="audio/x-smd" /> <mimeMap fileExtension=".smi" mimeType="application/octet-stream" /> <mimeMap fileExtension=".smx" mimeType="audio/x-smd" /> <mimeMap fileExtension=".smz" mimeType="audio/x-smd" /> <mimeMap fileExtension=".snd" mimeType="audio/basic" /> <mimeMap fileExtension=".snp" mimeType="application/octet-stream" /> <mimeMap fileExtension=".spc" mimeType="application/x-pkcs7-certificates" /> <mimeMap fileExtension=".spl" mimeType="application/futuresplash" /> <mimeMap fileExtension=".spx" mimeType="audio/ogg" /> <mimeMap fileExtension=".src" mimeType="application/x-wais-source" /> <mimeMap fileExtension=".ssm" mimeType="application/streamingmedia" /> <mimeMap fileExtension=".sst" mimeType="application/vnd.ms-pki.certstore" /> <mimeMap fileExtension=".stl" mimeType="application/vnd.ms-pki.stl" /> <mimeMap fileExtension=".sv4cpio" mimeType="application/x-sv4cpio" /> <mimeMap fileExtension=".sv4crc" mimeType="application/x-sv4crc" /> <mimeMap fileExtension=".svg" mimeType="image/svg+xml" /> <mimeMap fileExtension=".svgz" mimeType="image/svg+xml" /> <mimeMap fileExtension=".swf" mimeType="application/x-shockwave-flash" /> <mimeMap fileExtension=".t" mimeType="application/x-troff" /> <mimeMap fileExtension=".tar" mimeType="application/x-tar" /> <mimeMap fileExtension=".tcl" mimeType="application/x-tcl" /> <mimeMap fileExtension=".tex" mimeType="application/x-tex" /> <mimeMap fileExtension=".texi" mimeType="application/x-texinfo" /> <mimeMap fileExtension=".texinfo" mimeType="application/x-texinfo" /> <mimeMap fileExtension=".tgz" mimeType="application/x-compressed" /> <mimeMap fileExtension=".thmx" mimeType="application/vnd.ms-officetheme" /> <mimeMap fileExtension=".thn" mimeType="application/octet-stream" /> <mimeMap fileExtension=".tif" mimeType="image/tiff" /> <mimeMap fileExtension=".tiff" mimeType="image/tiff" /> <mimeMap fileExtension=".toc" mimeType="application/octet-stream" /> <mimeMap fileExtension=".tr" mimeType="application/x-troff" /> <mimeMap fileExtension=".trm" mimeType="application/x-msterminal" /> <mimeMap fileExtension=".ts" mimeType="video/vnd.dlna.mpeg-tts" /> <mimeMap fileExtension=".tsv" mimeType="text/tab-separated-values" /> <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" /> <mimeMap fileExtension=".tts" mimeType="video/vnd.dlna.mpeg-tts" /> <mimeMap fileExtension=".txt" mimeType="text/plain" /> <mimeMap fileExtension=".u32" mimeType="application/octet-stream" /> <mimeMap fileExtension=".uls" mimeType="text/iuls" /> <mimeMap fileExtension=".ustar" mimeType="application/x-ustar" /> <mimeMap fileExtension=".vbs" mimeType="text/vbscript" /> <mimeMap fileExtension=".vcf" mimeType="text/x-vcard" /> <mimeMap fileExtension=".vcs" mimeType="text/plain" /> <mimeMap fileExtension=".vdx" mimeType="application/vnd.ms-visio.viewer" /> <mimeMap fileExtension=".vml" mimeType="text/xml" /> <mimeMap fileExtension=".vsd" mimeType="application/vnd.visio" /> <mimeMap fileExtension=".vss" mimeType="application/vnd.visio" /> <mimeMap fileExtension=".vst" mimeType="application/vnd.visio" /> <mimeMap fileExtension=".vsto" mimeType="application/x-ms-vsto" /> <mimeMap fileExtension=".vsw" mimeType="application/vnd.visio" /> <mimeMap fileExtension=".vsx" mimeType="application/vnd.visio" /> <mimeMap fileExtension=".vtx" mimeType="application/vnd.visio" /> <mimeMap fileExtension=".wav" mimeType="audio/wav" /> <mimeMap fileExtension=".wax" mimeType="audio/x-ms-wax" /> <mimeMap fileExtension=".wbmp" mimeType="image/vnd.wap.wbmp" /> <mimeMap fileExtension=".wcm" mimeType="application/vnd.ms-works" /> <mimeMap fileExtension=".wdb" mimeType="application/vnd.ms-works" /> <mimeMap fileExtension=".webm" mimeType="video/webm" /> <mimeMap fileExtension=".wks" mimeType="application/vnd.ms-works" /> <mimeMap fileExtension=".wm" mimeType="video/x-ms-wm" /> <mimeMap fileExtension=".wma" mimeType="audio/x-ms-wma" /> <mimeMap fileExtension=".wmd" mimeType="application/x-ms-wmd" /> <mimeMap fileExtension=".wmf" mimeType="application/x-msmetafile" /> <mimeMap fileExtension=".wml" mimeType="text/vnd.wap.wml" /> <mimeMap fileExtension=".wmlc" mimeType="application/vnd.wap.wmlc" /> <mimeMap fileExtension=".wmls" mimeType="text/vnd.wap.wmlscript" /> <mimeMap fileExtension=".wmlsc" mimeType="application/vnd.wap.wmlscriptc" /> <mimeMap fileExtension=".wmp" mimeType="video/x-ms-wmp" /> <mimeMap fileExtension=".wmv" mimeType="video/x-ms-wmv" /> <mimeMap fileExtension=".wmx" mimeType="video/x-ms-wmx" /> <mimeMap fileExtension=".wmz" mimeType="application/x-ms-wmz" /> <mimeMap fileExtension=".woff" mimeType="font/x-woff" /> <mimeMap fileExtension=".wps" mimeType="application/vnd.ms-works" /> <mimeMap fileExtension=".wri" mimeType="application/x-mswrite" /> <mimeMap fileExtension=".wrl" mimeType="x-world/x-vrml" /> <mimeMap fileExtension=".wrz" mimeType="x-world/x-vrml" /> <mimeMap fileExtension=".wsdl" mimeType="text/xml" /> <mimeMap fileExtension=".wtv" mimeType="video/x-ms-wtv" /> <mimeMap fileExtension=".wvx" mimeType="video/x-ms-wvx" /> <mimeMap fileExtension=".x" mimeType="application/directx" /> <mimeMap fileExtension=".xaf" mimeType="x-world/x-vrml" /> <mimeMap fileExtension=".xaml" mimeType="application/xaml+xml" /> <mimeMap fileExtension=".xap" mimeType="application/x-silverlight-app" /> <mimeMap fileExtension=".xbap" mimeType="application/x-ms-xbap" /> <mimeMap fileExtension=".xbm" mimeType="image/x-xbitmap" /> <mimeMap fileExtension=".xdr" mimeType="text/plain" /> <mimeMap fileExtension=".xht" mimeType="application/xhtml+xml" /> <mimeMap fileExtension=".xhtml" mimeType="application/xhtml+xml" /> <mimeMap fileExtension=".xla" mimeType="application/vnd.ms-excel" /> <mimeMap fileExtension=".xlam" mimeType="application/vnd.ms-excel.addin.macroEnabled.12" /> <mimeMap fileExtension=".xlc" mimeType="application/vnd.ms-excel" /> <mimeMap fileExtension=".xlm" mimeType="application/vnd.ms-excel" /> <mimeMap fileExtension=".xls" mimeType="application/vnd.ms-excel" /> <mimeMap fileExtension=".xlsb" mimeType="application/vnd.ms-excel.sheet.binary.macroEnabled.12" /> <mimeMap fileExtension=".xlsm" mimeType="application/vnd.ms-excel.sheet.macroEnabled.12" /> <mimeMap fileExtension=".xlsx" mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" /> <mimeMap fileExtension=".xlt" mimeType="application/vnd.ms-excel" /> <mimeMap fileExtension=".xltm" mimeType="application/vnd.ms-excel.template.macroEnabled.12" /> <mimeMap fileExtension=".xltx" mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.template" /> <mimeMap fileExtension=".xlw" mimeType="application/vnd.ms-excel" /> <mimeMap fileExtension=".xml" mimeType="text/xml" /> <mimeMap fileExtension=".xof" mimeType="x-world/x-vrml" /> <mimeMap fileExtension=".xpm" mimeType="image/x-xpixmap" /> <mimeMap fileExtension=".xps" mimeType="application/vnd.ms-xpsdocument" /> <mimeMap fileExtension=".xsd" mimeType="text/xml" /> <mimeMap fileExtension=".xsf" mimeType="text/xml" /> 是信息的生成者,其他每个人都有兴趣知道它何时发生变化。它也是模型 - 视图 - 控制器范例的变体