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);
}
}
Ïà¹ØÎĵµ£º
as ²»ÔÊÐíoverload...¼´¶ÔÓÚͬһ¸öº¯ÊýÃû²»ÄÜÓв»Í¬µÄ²ÎÊýÁбíºÍ·µ»ØÖµ
ÀàÖеÄgeter ºÍ setter ÓëÆäËûµÄ·½·¨Ò»Ñù,³ýÁË
1.getº¯ÊýûÓвÎÊý,²¢ÇÒ±ØÐëÓзµ»ØÖµ,²¢ÇÒ±ØÐëÓÐget¹Ø¼ü×Ö
2.setº¯Êý±ØÐëÓвÎÊý²¢ÇÒûÓзµ»ØÖµ,²¢ÇÒ±ØÐëÓÐset¹Ø¼ü×Ö
Java´úÂë
public function get sampleProperty( ):Str ......
JDK
Sun JDK
http://java.sun.com/javase/downloads/index.jsp
IBM JDK
http://www.ibm.com/developerworks/java/
http://www.ibm.com/developerworks/cn/java/
IDE:
Eclipse
http://www.eclipse.org/
Container:
Apache HTTP server
http://www.apache.org/
Tomcat: JSP,Servlet,JavaBean container.
http:// ......
1¡¢Ê×ÏÈ´ó¼Ò×îºÃÈ¥ÏÂÔØÒ»¸ödesigner µÄeclipse ²å¼þ
2¡¢È»ºó·ÅÈëeclipse °²×°Ä¿Â¼ÏµÄpluginĿ¼ÏÂ
3¡¢ÖØÐÂÆô¶¯eclipse
4 н¨Ò»¸öjava swing project
5, н¨Ò»¸öwindow£¬È»ºóµãÔËÐУ¬¾Í»á³öÏÖÒ»¸ö×î¼òµ¥µÄ´°¿Ú¡£
µ±È»£¬ÄãÒ²¿ÉÒÔн¨Ò»¸öclass Window£¬È»ºóÊäÈëÈçÏ´úÂë
import java.awt.Dimension;
import ......
¼ÙÉèÐèÇó(ÈçÓÐÀ×ͬ£¬´¿ÊôÇɺÏ)£º
ÓÐÒ»¸öÈ«¹úÐԵĴóÆóÒµ£¬ÔÚÈ«¹ú¸÷µØÐèÒª²¿ÊðÉÏǧ̨¿Í»§»ú£¬ÕâЩ¿Í»§»úÐèҪʵʱÓë·þÎñÆ÷½»»¥£¬½øÐÐÊý¾Ý´¦Àí¡£ÊµÊ±ÐÔÒªÇó¸ß£¬°²È«ÐԸߣ¬ÒªÇóÖ§³ÖÊÂÎñ£¬ÒÔ¼°²»ÖжϷþÎñ¡£
Ó²¼þ²¿Êð£º
1¡¢ 3000̨¿Í»§»ú
2¡¢ 10̨· ......
import java.io.*;
public class Test {
public static String convert(String s) {
if (s == null || s.length() == 0)
return s;
  ......