Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 279 → Rev 280

/DUBwise/trunk/j2me/installer/src/DUBwiseInstallerCanvas.java
0,0 → 1,126
/***************************************************************
*
* Canvas of DUBwise Installer
*
* Author: Marcus -LiGi- Bueschleb
* Mailto: LiGi @at@ LiGi DOTT de
*
***************************************************************/
 
import javax.microedition.lcdui.*;
import java.io.*;
import javax.microedition.io.*;
 
public class DUBwiseInstallerCanvas
extends Canvas
implements Runnable
{
 
// values to detect
int canvas_width=-1;
int canvas_height=-1;
 
int canvas_full_width=-1;
int canvas_full_height=-1;
boolean fullscreen=false;
boolean locationprovider;
boolean devicecontrol;
boolean bluetooth;
boolean cldc11;
boolean fileapi;
 
String comports;
String props;
// end values to detect
 
DUBwiseInstaller root;
 
public boolean try_class(String class_name)
{
try
{
Class.forName(class_name);
}
 
catch (Exception e)
{
return false;
}
return true;
}
public DUBwiseInstallerCanvas(DUBwiseInstaller _root)
 
{
root=_root;
new Thread(this).start();
}
 
 
public void run()
{
 
repaint();
serviceRepaints();
try
{
Thread.sleep(500);
}
catch (Exception e)
{}
 
locationprovider=try_class("javax.microedition.location.LocationProvider");;
devicecontrol=try_class("com.nokia.mid.ui.DeviceControl");
bluetooth=try_class("javax.bluetooth.DiscoveryAgent");
cldc11=try_class("java.lang.Math");
fileapi=try_class("javax.microedition.io.file.FileConnection");
comports=System.getProperty("microedition.commports")+"\n";
props="enc: " +System.getProperty("microedition.encoding")+"\n";
props+="platform: " +System.getProperty("microedition.platform")+"\n";
props+="locale: " +System.getProperty("microedition.locale")+"\n";
props+="config:" + System.getProperty("microedition.configuration")+"\n";
props+="profiles: " +System.getProperty("microedition.profiles")+"\n";
props+="hostname: " +System.getProperty("microedition.hostname")+"\n";
props+="loc-version: " +System.getProperty("microedition.location.version ")+"\n";
 
 
root.quit();
 
}
 
 
boolean fs_check=true;
 
public void paint(Graphics g)
{
 
if (fs_check) try
{
 
setFullScreenMode(false);
canvas_width=this.getWidth();
canvas_height=this.getHeight();
 
setFullScreenMode(true);
canvas_full_width=this.getWidth();
canvas_full_height=this.getHeight();
 
fullscreen=((canvas_full_width!=canvas_width)||(canvas_full_height!=canvas_height));
}
catch (Exception e)
{
canvas_width=this.getWidth();
canvas_height=this.getHeight();
canvas_full_width=this.getWidth();
canvas_full_height=this.getHeight();
 
}
 
fs_check=false;
g.setColor(0);
g.fillRect(0,0,canvas_full_width,canvas_full_height);
g.setColor(0x00BB00);
g.drawString("Detecting Hardware",0,0,Graphics.LEFT | Graphics.TOP);
 
}
}