我正在製作一個Java小程序,它必須播放視頻文件。我已經在網上搜索一個代碼,但它給在getParameter
如何處理java代碼中的getParameter()?
這裏是代碼中的錯誤...
public void init() {
//$ System.out.println("Applet.init() is called");
setLayout(null);
setBackground(Color.white);
panel = new Panel();
panel.setLayout(null);
add(panel);
panel.setBounds(0, 0, 320, 240);
// input file name from html param
String mediaFile = null;
// URL for our media file
MediaLocator mrl = null;
URL url = null;
// Get the media filename info.
// The applet tag should contain the path to the
// source media file, relative to the html page.
// Error here: Invalid media file parameter
if ((mediaFile = getParameter("C:\\Users\\asim\\Documents\\JCreator LE\\MyProjects\\SimplePlayerApplet\\src\\Movie.avi")) == null)
Fatal("Invalid media file parameter");
try {
url = new URL(getDocumentBase(), mediaFile);
mediaFile = url.toExternalForm();
} catch (MalformedURLException mue) {
}
這裏是鏈接到整個代碼:
http://docs.oracle.com/javase/1.4.2/docs/guide/plugin/developer_guide/SimplePlayerApplet.java.html
根據已經提供的「答案」,您是否可以更新您的代碼和HTML,然後將它們粘貼到上面,包括任何可能仍然存在的錯誤。 – radimpe