JAVAºÍFlexÃô½Ýµ÷ÓÃ(¶þ)
FlexÔÚºÍjavaµ÷Óùý³ÌÖУ¬ÆäʵÓиü¼ÓÁé»îµÄ°ì·¨À´Ìá¸ßϵͳµÄÃô½Ý¶È£¬¼«´óÌá¸ßϵͳµÄñîºÏºÍ¿ª·¢Ð§ÂÊ¡£ÔÚÕâÀïÎÒ¼ÌÐø¸ø´ó¼Ò½éÉÜһϣ¬Ãô½Ýµ÷ÓÃÖеÄjava¶¯Ì¬´úÂëµ÷Óá£
ÏÈ¿´javaµÄÀà(BeanShell)ÕâÀïÖ÷ÒªÊǽÓÊÕjava´úÂëÀ´¶¯Ì¬µ÷ÓõÄ
package com.shine.framework.beanShell;
import bsh.Interpreter;
public class BeanShell {
public Object executBeanShell(String code) {
try {
Interpreter inter = new Interpreter();
inter.eval(code);
return inter.get("result");
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
È»ºó°Ñ¸ÃÀàÅäÖõ½remoting-config.xml
<destination id="beanShell">
<properties>
<source>com.shine.framework.beanShell.BeanShell</source>
</properties>
</destination>
ÔÙдһ¸ö¾²Ì¬µÄbeanShellÔÚactionscript£¬ÒÔµ¥Àýģʽ
package com.shine.framework.beanShell
{
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.remoting.mxml.RemoteObject;
import mx.controls.Alert;
public class BeanShell
{
private static var _instance:BeanShell;
private var method:Function;
public function BeanShell(enforcer:SingletonEnforcer)
{
}
public static function getInstance():BeanShell
{
if (BeanShell._instance == null)
{
BeanShell._instance=new BeanShell(new SingletonEnforcer());
}
return BeanShell._instance;
}
public function beanShell(code:String, method:Function=null):void
{
this.method=method;
var beanShell:RemoteObject=new RemoteObject;
beanShell.destination="beanShell";
beanShell.addEventListener(FaultEvent.FAULT, error);
beanShell.endpoint="messagebroker/amf";
beanShell.executBeanShell(code);
beanShell.addEventListener(ResultEvent.RESULT, getRomoteHelloRes);
}
private function getRomoteHelloRes(e:ResultEvent):void
{
if(this.method!=null){
this.method.call(this, e.result);
}
}
Ïà¹ØÎĵµ£º
component¾ÍÊÇÒ»¸öAS class »òÕßÊÇMXML componentÎļþÔÚmanifestÎļþÖÐÓ³ÉäµÄ±êÇ©.·Ö¿ÉÊӺͲ»¿ÉÊÓ
¿ÉÊÓ»¯component°üÀ¨Containers ºÍ UI controls
Containers(Appliction, Panel...)
UI controls(Button, Label)
¿ÉÒÔͨ¹ý3ÖÖ·½Ê½ÉèÖÃcomponentµÄÊôÐÔ
1.tag attributers
Java´úÂë
<mx:Application xmln ......
1¡¢Ê×ÏÈ´ó¼Ò×îºÃÈ¥ÏÂÔØÒ»¸ödesigner µÄeclipse ²å¼þ
2¡¢È»ºó·ÅÈëeclipse °²×°Ä¿Â¼ÏµÄpluginĿ¼ÏÂ
3¡¢ÖØÐÂÆô¶¯eclipse
4 н¨Ò»¸öjava swing project
5, н¨Ò»¸öwindow£¬È»ºóµãÔËÐУ¬¾Í»á³öÏÖÒ»¸ö×î¼òµ¥µÄ´°¿Ú¡£
µ±È»£¬ÄãÒ²¿ÉÒÔн¨Ò»¸öclass Window£¬È»ºóÊäÈëÈçÏ´úÂë
import java.awt.Dimension;
import ......
1¡¢Ñ§»áÔõôÉèÖû·¾³±äÁ¿
´ð°¸£ºÔÚÎҵĵçÄÔÀïÉèÖÃ
2¡¢Ñ§»áÔõôÉèÖÃjava ³ÌÐòÊäÈë²ÎÊý
´ð°¸£ºmain ²ÎÊýÊý×é
3 ѧ»áÔõôÉèÖà classpath·¾¶£¬ÒÔ¼°classpathÊǸÉôµÄ
´ð°¸£ºÒýÓõÄÀàµÄ·¾¶
4 ÖªµÀjarÎÄ ......
¼ÙÉèÐèÇó(ÈçÓÐÀ×ͬ£¬´¿ÊôÇɺÏ)£º
ÓÐÒ»¸öÈ«¹úÐԵĴóÆóÒµ£¬ÔÚÈ«¹ú¸÷µØÐèÒª²¿ÊðÉÏǧ̨¿Í»§»ú£¬ÕâЩ¿Í»§»úÐèҪʵʱÓë·þÎñÆ÷½»»¥£¬½øÐÐÊý¾Ý´¦Àí¡£ÊµÊ±ÐÔÒªÇó¸ß£¬°²È«ÐԸߣ¬ÒªÇóÖ§³ÖÊÂÎñ£¬ÒÔ¼°²»ÖжϷþÎñ¡£
Ó²¼þ²¿Êð£º
1¡¢ 3000̨¿Í»§»ú
2¡¢ 10̨· ......