本文整理汇总了Java中javax.microedition.midlet.MIDlet类的典型用法代码示例。如果您正苦于以下问题:Java MIDlet类的具体用法?Java MIDlet怎么用?Java MIDlet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MIDlet类属于javax.microedition.midlet包,在下文中一共展示了MIDlet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newMIDletPeer
import javax.microedition.midlet.MIDlet; //导入依赖的package包/类
/**
* Called by the MIDlet constructor to a new MIDletPeer object.
*
* @param token security token for authorizing the caller
* @param m the MIDlet for which this state is being created;
* must not be <code>null</code>.
* @return the preallocated MIDletPeer for the MIDlet being constructed by
* {@link #createMIDlet}
*
* @exception SecurityException AMS permission is not granted and
* if is constructor is not being called in the context of
* <code>createMIDlet</code>.
*/
public static MIDletPeer newMIDletPeer(SecurityToken token, MIDlet m) {
token.checkIfPermissionAllowed(Permissions.MIDP);
synchronized (createMIDletLock) {
MIDletPeer temp;
if (newMidletPeer == null) {
throw new SecurityException(
"MIDlet not constructed by createMIDlet.");
}
temp = newMidletPeer;
newMidletPeer = null;
temp.midlet = m;
return temp;
}
}
示例2: exportObject
import javax.microedition.midlet.MIDlet; //导入依赖的package包/类
/**
* exportObject exports the NinjaRemoteObject for remote access. Only call
* this function if you call the NinjaRemoteObject constructor with an
* argument of <tt>null</tt>. The intent here is that the user can
* construct a NinjaExportData structure before calling exportObject -
* because superclass constructors must be the first thing called in a
* constructor.
*
// * @param exportData
* The NinjaExportData structure specifying how the object should
* be exported.
*/
public void exportObject(String nodeName,String serverServiceName, String preferredNetwork, MIDlet midlet
// NinjaExportData exportData
) throws Exception {
// DEBUG(System.out.println("NinjaRemoteObject exportObject called"));
debug.print("NinjaRemoteObject exportObject called");
servref = new NinjaServerRef();
// if (exportData == null)
// throw new Exception(
// "exportObject: Can't export object without exportData defined!");
try {
// DEBUG(System.out.println("Exporting ref..."));
debug.print("Exporting ref...");
servref.exportObject( this, nodeName, serverServiceName, preferredNetwork, midlet);
// , exportData);
} catch (Exception e) {
throw new Exception("Can't export remote object"+ e.getMessage());
}
// DEBUG(System.out.println("Exported object!"));
debug.print("Exported object!");
}
示例3: CameraCanvas
import javax.microedition.midlet.MIDlet; //导入依赖的package包/类
public CameraCanvas(MIDlet midlet, VideoControl videoControl) {
int width = getWidth();
int height = getHeight();
// mMIDlet = midlet;
videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
try {
videoControl.setDisplayLocation(2, 2);
videoControl.setDisplaySize(width - 4, height - 4);
}
catch (MediaException me) {
try { videoControl.setDisplayFullScreen(true); }
catch (MediaException me2) {}
}
videoControl.setVisible(true);
}
示例4: ImageChooserState
import javax.microedition.midlet.MIDlet; //导入依赖的package包/类
public ImageChooserState(MIDlet midlet)
{
this.midlet = midlet;
transitions = this;
allImages = new Hashtable();
cancelCommand = new Command("Cancel", Command.CANCEL, 0);
returnCommand = new Command("Return", Command.OK, 0);
cameraCommand = new Command("Camera", Command.SCREEN, 0);
browseCommand = new Command("Browse", Command.SCREEN, 0);
viewCommand = new Command("View", Command.SCREEN, 0);
deleteCommand = new Command("Delete", Command.SCREEN, 0);
changeSniffDirectoryCommand = new Command("Change Search Directory", Command.SCREEN, 0);
try
{
fileService = getFileService();
}
catch(UnavailableServiceException ue)
{
serviceUnavailable(ue);
}
}
示例5: Reliable_ServerThread
import javax.microedition.midlet.MIDlet; //导入依赖的package包/类
Reliable_ServerThread(NinjaServerRef serverref,String nodeName,String serverServiceName, String preferredNetwork, MIDlet midlet) //, FrameworkListener fl)
// , int theport)
throws Exception {
super(serverref);
if (Servref== null)
Servref= new Vector();
Servref.addElement(serverref);
debug = new Debug();
is_server = true;
fl = FrameworkFrontEnd.getInstance(this);
fl.initFramework(nodeName, serverServiceName, preferredNetwork);
String ConnectionUrl=((FrameworkFrontEnd)fl).currentNetwork.connectionURL;
PushRegistry.registerConnection(ConnectionUrl, midlet.getClass().getName(), "*");
//meisam
/* serverSocket = new ServerSocket(theport);
port = serverSocket.getLocalPort();
this.setName("Reliable_ServerThread (toplevel) on port " + port); */
}
示例6: Reliable_ServerThread
import javax.microedition.midlet.MIDlet; //导入依赖的package包/类
Reliable_ServerThread(NinjaServerRef serverref,String nodeName,String serverServiceName, String preferredNetwork, MIDlet midlet) //, FrameworkListener fl)
// , int theport)
throws Exception {
super(serverref);
if (Servref== null)
Servref= new Vector();
Servref.addElement(serverref);
debug = new Debug();
is_server = true;
fl = FrameworkFrontEnd.getInstance(this);
fl.setFrameworkListener(this); // this is added for debuging whin we add the server to registry
fl.initFramework(nodeName, serverServiceName, preferredNetwork);
String ConnectionUrl=((FrameworkFrontEnd)fl).currentNetwork.connectionURL;
// PushRegistry.registerConnection(ConnectionUrl, midlet.getClass().getName(), "*");
//meisam
/* serverSocket = new ServerSocket(theport);
port = serverSocket.getLocalPort();
this.setName("Reliable_ServerThread (toplevel) on port " + port); */
}
示例7: isEnabled
import javax.microedition.midlet.MIDlet; //导入依赖的package包/类
/**
* Checks the value of a Jad attribute and returns the corresponding
* boolean value.
* Only attributes that have <code>enabled</code> and <code>disabled</code>
* should be used with this method.
*
* @param midlet the MIDlet which Jad attributes to read.
* @param id logging setup identifier or <code>null</code> to use common logging setup.
* @param attrName name of the attribute to check.
* @param defaultValue default value to be used in case the attribute is not defined.
*
* @return <code>true</code> if the specified attribute has the value
* <code>enabled</code> and <code>false</code> otherwise.
*/
private static final boolean isEnabled(MIDlet midlet, String id, String attrName, boolean defaultValue) {
String origAttrName = attrName;
if (id != null) {
// Read setup specific attribute first.
attrName = id + "-" + attrName;
}
String value = midlet.getAppProperty(attrName);
if (value == null) {
if (id != null) {
// Setup specific value not specified - use common logging setup instead.
return isEnabled(midlet, null, origAttrName, defaultValue);
}
return defaultValue;
} else if (value.equalsIgnoreCase("enabled")) {
return true;
} else {
return false;
}
}
示例8: getInstallURL
import javax.microedition.midlet.MIDlet; //导入依赖的package包/类
/**
* Get a URL to install from the Invocation mechanism, if one
* has been queued.
* @param midlet to check for an invocation
* @return the URL to install; <code>null</code> if none available.
* @see com.sun.midp.content.CHManagerImpl
*/
public String getInstallURL(MIDlet midlet) {
try {
handler = Registry.getServer(midlet.getClass().getName());
} catch (ContentHandlerException che) {
return null;
}
installInvoc = handler.getRequest(false);
if (installInvoc != null) {
String url = installInvoc.getURL();
if (url != null && url.length() > 0) {
return url;
}
}
return null;
}
示例9: register
import javax.microedition.midlet.MIDlet; //导入依赖的package包/类
/**
* Registers a MIDlet being constructed.
*
* @param midlet to be registered with this state handler
*/
private void register(MIDlet midlet) {
synchronized (this) {
MIDletPeer state = MIDletPeer.getMIDletPeer(midlet);
/*
* If a MIDlet of the same class is already running
* Make the existing MIDlet current so that startSuite()
* will run it
*/
int i = findMIDletByClass(state);
if (i >= 0) {
state.setState(MIDletPeer.DESTROY_PENDING);
// Fall into adding it to the list so destroyApp
// can be called at a reasonable time.
}
// Grow the list if necessary
if (nmidlets >= midlets.length) {
MIDletPeer[] n = new MIDletPeer[nmidlets+5];
System.arraycopy(midlets, 0, n, 0, nmidlets);
midlets = n;
}
// Add it to the end of the list
midlets[nmidlets++] = state;
// MIDlet peer is registered now
underConstructionPeer = null;
this.notify();
}
}
示例10: init
import javax.microedition.midlet.MIDlet; //导入依赖的package包/类
public static void init(MIDlet m, InitializationListener listener) {
i = new CommCareContext();
try{
i.configureApp(m, listener);
} catch(Exception e) {
Logger.die("Init!", e);
}
}
示例11: init
import javax.microedition.midlet.MIDlet; //导入依赖的package包/类
public void init (MIDlet m) {
DumpRMS.RMSRecoveryHook(m);
loadModules();
//After load modules, so polish translations can be inserted.
setMidlet(m);
addCustomLanguages();
setProperties();
UserUtility.populateAdminUser(m);
loadRootTranslator();
}
示例12: getInstance
import javax.microedition.midlet.MIDlet; //导入依赖的package包/类
public static synchronized Reliable_ServerThread getInstance(NinjaServerRef serverref,String nodeName,String serverServiceName, String preferredNetwork, MIDlet midlet)
// , int theport)
throws Exception {
if(singleton == null){
singleton = new Reliable_ServerThread(serverref,nodeName, serverServiceName, preferredNetwork, midlet);
}else {
Servref.addElement(serverref);
}
Reliable_ServerThread framework = singleton;
return framework;
}
示例13: getInstance
import javax.microedition.midlet.MIDlet; //导入依赖的package包/类
public static Reliable_ServerThread getInstance(NinjaServerRef serverref,String nodeName,String serverServiceName, String preferredNetwork, MIDlet midlet)
// , int theport)
throws Exception {
if(singleton == null){
singleton = new Reliable_ServerThread(serverref,nodeName, serverServiceName, preferredNetwork, midlet);
singleton.runActive=false;
// singleton.run();
singleton.start();
}else {
Servref.addElement(serverref);
}
Reliable_ServerThread framework = singleton;
return framework;
}
示例14: TheServiceImpl
import javax.microedition.midlet.MIDlet; //导入依赖的package包/类
public TheServiceImpl(String nodeName, String serverServiceName, String preferredNetwork, MIDlet midlet) throws Exception {
// super(null); // This prevents the object from being exported with
// the defaults.
super(nodeName,serverServiceName, preferredNetwork, midlet);
// Create a NinjaExportData structure so we can specify the callbacks.
// NinjaExportData data = new NinjaExportData();
// data.callbacks = new MyCallbacks(); //meisam
// OK, now export the object with this NinjaExportData structure.
//by meisam: for I added exportObject in super() constructor
// this.exportObject();
System.out
.println("This is the serviceclass constructor method being called\n");
}
示例15: clientThread
import javax.microedition.midlet.MIDlet; //导入依赖的package包/类
clientThread (Form currentForm, MIDlet currentMIDlet,String nodeName, String preferredNetwork,TheService service){
this.currentMIDlet=currentMIDlet;
this.currentForm=currentForm;
this.nodeName=nodeName;
this.preferredNetwork=preferredNetwork;
this.service=service;
}