28 Mart 2011 Pazartesi

using Java FX app in a web application

In order to pass media url as argument to Java FX MediaBox component,
  • change the Main.fxin MediaBox project as follows:
var mediaUrl = FX.getArgument("mediaUrl");

// in order to access mediaUrl, use mediaUrl.toString()
  • create a java web application project (i used Netbeans 6.5.1 for this).
  • edit index.jsp as follows:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<script src="http://dl.javafx.com/dtfx.js"></script>
<script>
javafx(
{
archive: "MediaBox.jar",
width: 640,
height: 360,
code: "com.sun.javafx.mediabox.Main",
name: "MediaBox"
}, {
mediaUrl: "http://sun.edgeboss.net/download/sun/media/1460825906/1460825906_2956241001_big-buck-bunny-640x360.flv"
/*"file:/E:/htarakci/WORKSTATION/tez/projects/lost.avi"*/
}
);
</script>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
  • deploy the web app to server and run..

javafx samples here:

for deploying Javafx app:

for passing arguments to Javafx app:

a few tips on writing scripts:

Hiç yorum yok:

Yorum Gönder