⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jmappscfg.java

📁 里面是关于jmf编程的例子,希望能给初学者带来一些帮助
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * @(#)JMAppsCfg.java	1.4 00/03/31 * * Copyright (c) 1999 Sun Microsystems, Inc. All Rights Reserved. * * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use, * modify and redistribute this software in source and binary code form, * provided that i) this copyright notice and license appear on all copies of * the software; and ii) Licensee does not utilize the software in a manner * which is disparaging to Sun. * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * * This software is not designed or intended for use in on-line control of * aircraft, air traffic, aircraft navigation or aircraft communications; or in * the design, construction, operation or maintenance of any nuclear * facility. Licensee represents and warrants that it will not use or * redistribute the Software for such purposes. */package jmapps.util;import java.util.*;import java.io.*;import java.awt.*;import javax.media.*;import com.sun.media.util.JMFI18N;import jmapps.ui.*;public class JMAppsCfg {    public static final String  KEY_OPEN_FILE = "Last Open File";    public static final String  KEY_OPEN_RTP = "Last Open RTP";    public static final String  KEY_OPEN_URL = "Last Open URL";    public static final String  KEY_CAPTURE_AUDIO = "Last Capture Audio Device";    public static final String  KEY_CAPTURE_VIDEO = "Last Capture Video Device";    public static final String  KEY_TRANSMIT_RTP = "Last Transmit RTP";    public static final String  KEY_TRANSMIT_SOURCE = "Last Transmit Source";    public static final String  KEY_SAVE_FILE_CONTENT = "Last Save File Content Type";    public static final String  KEY_SAVE_FILE_TRACKS = "Last Save File Tracks";    public static final String  KEY_SAVE_FILE_DIR = "Last Save File Directory";    public static final String  KEY_RECENT_URL = "Recent URL";    public static final String  KEY_JMSTUDIO_FRAME_POS = "Location of JMStudio Frame";    public static final String  KEY_AUTO_PLAY = "Auto Play";    public static final String  KEY_AUTO_LOOP = "Auto Loop";    public static final String  KEY_KEEP_ASPECT = "Keep Aspect Ratio";    private static String               nameFileCfg = ".JMAppsCfg";    private static final String         signatureFileCfg = "JMStudio configuration data file.";    private static final String         signatureHashtable = "Embedded Hashtable";    private Hashtable   hashProperties = new Hashtable();    public JMAppsCfg () {        try {            init();        }        catch ( Exception exception ) {            exception.printStackTrace ();        }    }    public void save () {        saveFile ();    }    public String getLastOpenFile () {        Object  objValue;        String  strFile = null;        objValue = hashProperties.get ( KEY_OPEN_FILE );        if ( objValue != null )            strFile = objValue.toString ();        return ( strFile );    }    public void setLastOpenFile ( String strFile ) {        hashProperties.put ( KEY_OPEN_FILE, strFile );    }    public RtpData getLastOpenRtpData () {        Object          objValue;        RtpData         dataRtp = null;        objValue = hashProperties.get ( KEY_OPEN_RTP );        if ( objValue != null  &&  objValue instanceof RtpData )            dataRtp =(RtpData)objValue;        return ( dataRtp );    }    public void setLastOpenRtpData ( RtpData dataRtp ) {        hashProperties.put ( KEY_OPEN_RTP, dataRtp );    }    public String getLastTransmitRtpSource () {        Object  objValue;        String  strValue = null;        objValue = hashProperties.get ( KEY_TRANSMIT_SOURCE );        if ( objValue != null )            strValue = objValue.toString ();        return ( strValue );    }    public void setLastTransmitRtpSource ( String strValue ) {        hashProperties.put ( KEY_TRANSMIT_SOURCE, strValue );    }    public RtpData getLastTransmitRtpData ( String strTrack ) {        Object          objValue;        RtpData         dataRtp = null;        Hashtable       hashTransmitRtp;        objValue = hashProperties.get ( KEY_TRANSMIT_RTP );        if ( objValue != null  &&  objValue instanceof Hashtable ) {            hashTransmitRtp = (Hashtable) objValue;        }        else {            hashTransmitRtp = new Hashtable ();            hashProperties.put ( KEY_TRANSMIT_RTP, hashTransmitRtp );        }        objValue = hashTransmitRtp.get ( strTrack );        if ( objValue != null  &&  objValue instanceof RtpData )            dataRtp =(RtpData)objValue;        return ( dataRtp );    }    public void setLastTransmitRtpData ( RtpData dataRtp, String strTrack ) {        Object          objValue;        Hashtable       hashTransmitRtp;        objValue = hashProperties.get ( KEY_TRANSMIT_RTP );        if ( objValue != null  &&  objValue instanceof Hashtable ) {            hashTransmitRtp = (Hashtable) objValue;        }        else {            hashTransmitRtp = new Hashtable ();            hashProperties.put ( KEY_TRANSMIT_RTP, hashTransmitRtp );        }        hashTransmitRtp.put ( strTrack, dataRtp );    }    public String getLastOpenUrl () {        Object  objValue;        String  strValue = null;        objValue = hashProperties.get ( KEY_OPEN_URL );        if ( objValue != null )            strValue = objValue.toString ();        return ( strValue );    }    public void setLastOpenUrl ( String strValue ) {        hashProperties.put ( KEY_OPEN_URL, strValue );    }    public CaptureDeviceData getLastCaptureAudioData () {        Object                  objValue;        CaptureDeviceData       dataCapture = null;        objValue = hashProperties.get ( KEY_CAPTURE_AUDIO );        if ( objValue != null  &&  objValue instanceof CaptureDeviceData )            dataCapture =(CaptureDeviceData)objValue;        return ( dataCapture );    }    public void setLastCaptureAudioData ( CaptureDeviceData dataCapture ) {        hashProperties.put ( KEY_CAPTURE_AUDIO, dataCapture );    }    public CaptureDeviceData getLastCaptureVideoData () {        Object                  objValue;        CaptureDeviceData       dataCapture = null;        objValue = hashProperties.get ( KEY_CAPTURE_VIDEO );        if ( objValue != null  &&  objValue instanceof CaptureDeviceData )            dataCapture =(CaptureDeviceData)objValue;        return ( dataCapture );    }    public void setLastCaptureVideoData ( CaptureDeviceData dataCapture ) {        hashProperties.put ( KEY_CAPTURE_VIDEO, dataCapture );    }    public String getLastSaveFileContentType () {        Object  objValue;        String  strValue = null;        objValue = hashProperties.get ( KEY_SAVE_FILE_CONTENT );        if ( objValue != null )            strValue = objValue.toString ();        return ( strValue );    }    public void setLastSaveFileContentType ( String strValue ) {        hashProperties.put ( KEY_SAVE_FILE_CONTENT, strValue );    }    public TrackData getLastSaveFileTrackData ( String strTrack ) {        Object          objValue;        TrackData       dataTrack = null;        Hashtable       hashSaveFile;        objValue = hashProperties.get ( KEY_SAVE_FILE_TRACKS );        if ( objValue != null  &&  objValue instanceof Hashtable ) {            hashSaveFile = (Hashtable) objValue;        }        else {            hashSaveFile = new Hashtable ();            hashProperties.put ( KEY_SAVE_FILE_TRACKS, hashSaveFile );        }        objValue = hashSaveFile.get ( strTrack );        if ( objValue != null  &&  objValue instanceof TrackData )            dataTrack =(TrackData)objValue;        return ( dataTrack );    }    public void setLastSaveFileTrackData ( TrackData dataTrack, String strTrack ) {        Object          objValue;        Hashtable       hashSaveFile;        objValue = hashProperties.get ( KEY_SAVE_FILE_TRACKS );        if ( objValue != null  &&  objValue instanceof Hashtable ) {            hashSaveFile = (Hashtable) objValue;        }        else {            hashSaveFile = new Hashtable ();            hashProperties.put ( KEY_SAVE_FILE_TRACKS, hashSaveFile );        }        hashSaveFile.put ( strTrack, dataTrack );    }    public String getLastSaveFileDir () {        Object  objValue;        String  strValue = null;        objValue = hashProperties.get ( KEY_SAVE_FILE_DIR );        if ( objValue != null )            strValue = objValue.toString ();        return ( strValue );    }    public void setLastSaveFileDir ( String strValue ) {        hashProperties.put ( KEY_SAVE_FILE_DIR, strValue );    }    public Enumeration getRecentUrlTypes () {        Enumeration     enumTypes = null;        Object          objValue;        Hashtable       hashRecentUrls;        objValue = hashProperties.get ( KEY_RECENT_URL );        if ( objValue != null  &&  objValue instanceof Hashtable ) {            hashRecentUrls = (Hashtable) objValue;            enumTypes = hashRecentUrls.keys ();        }        return ( enumTypes );    }    public Vector getRecentUrls ( String strUrlType ) {        Object          objValue;        Vector          vectorUrls = null;        Hashtable       hashRecentUrls;        objValue = hashProperties.get ( KEY_RECENT_URL );        if ( objValue != null  &&  objValue instanceof Hashtable ) {            hashRecentUrls = (Hashtable) objValue;        }        else {            hashRecentUrls = new Hashtable ();            hashProperties.put ( KEY_RECENT_URL, hashRecentUrls );        }        objValue = hashRecentUrls.get ( strUrlType );        if ( objValue != null  &&  objValue instanceof Vector )            vectorUrls =(Vector)objValue;        return ( vectorUrls );    }    public void addRecentUrls ( String strUrlType, String strUrl ) {        Object          objValue;        Vector          vectorUrls = null;        Hashtable       hashRecentUrls;        objValue = hashProperties.get ( KEY_RECENT_URL );        if ( objValue != null  &&  objValue instanceof Hashtable ) {            hashRecentUrls = (Hashtable) objValue;        }        else {            hashRecentUrls = new Hashtable ();            hashProperties.put ( KEY_RECENT_URL, hashRecentUrls );        }        objValue = hashRecentUrls.get ( strUrlType );        if ( objValue != null  &&  objValue instanceof Vector ) {            vectorUrls =(Vector)objValue;        }        else {            vectorUrls = new Vector ();            hashRecentUrls.put ( strUrlType, vectorUrls );        }        if ( vectorUrls.contains(strUrl) )            vectorUrls.removeElement ( strUrl );        else if ( vectorUrls.size() >= 16 )            vectorUrls.removeElementAt ( 15 );        vectorUrls.insertElementAt ( strUrl, 0 );    }    public Point getJMStudioFrameLocation ( int nFrameIndex ) {        int     nCount;        int     nIndex;        Object  objValue;        Point   pointValue = null;        Vector  vectorValues = null;        objValue = hashProperties.get ( KEY_JMSTUDIO_FRAME_POS );        if ( objValue != null  &&  objValue instanceof Vector ) {            vectorValues = (Vector) objValue;            nCount = vectorValues.size ();            if ( nFrameIndex < nCount )                nIndex = nFrameIndex;            else                nIndex = nCount - 1;            objValue = vectorValues.elementAt ( nIndex );            if ( objValue != null  &&  objValue instanceof Point ) {                pointValue = new Point ( (Point)objValue );                pointValue.x += 20 * (nFrameIndex - nIndex);                pointValue.y += 20 * (nFrameIndex - nIndex);            }        }        if ( pointValue == null )            pointValue = new Point ( 20 * nFrameIndex, 20 * nFrameIndex );        return ( pointValue );    }    public void setJMStudioFrameLocation ( Point pointValue, int nFrameIndex ) {        int     nCount;        Object  objValue;        Vector  vectorValues = null;        objValue = hashProperties.get ( KEY_JMSTUDIO_FRAME_POS );        if ( objValue != null  &&  objValue instanceof Vector ) {            vectorValues = (Vector) objValue;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -