vendredi 5 mars 2010

COMBINER LA PUISSANCE DE LWUIT DESIGNER et CELLE DU VISUAL MOBILE DESIGNER DE NETBEANS

LWUIT une API qui permet la création d'Interface grahique très attrayantes pour application mobile. Je n'ai pas l'intention de vous faire un tuto sur LWUIT mais plutôt de vous montrer comment vous pourrez combiner la puissance de LWUIT designer à celle du Visual Mobile designer intégré dans Netbeans. Vous pourrez vous même trouver un tutoriel bien fait sur LWUIT dans le site de SUN, l'article est titré : "The Lightweight User Interface Toolkit (LWUIT): An Introduction".


Vous pourrez vous même trouver un tutoriel bien fait sur LWUIT dans le site de SUN, l'article est titré : "The Lightweight User Interface Toolkit (LWUIT): An Introduction".

POSONS LE DECOR

Comme vous pouvez le voir sur le dessin du dessus, Visual Mobile Designer vous facilite la gestion des flux et des affichages de votre application ainsi que le code des éléments actifs. Tout ceci en générant du code pour vous. Sauf que les graphisme utilisent : import javax.microedition.lcdui.*; ... C'est pas jolie - jolie à voir.

LWUIT quand à lui vous créer une UI nettement plus belle à voir et riche en possibilités ... sauf que ce sera à vous de codé l'application javaME pour utiliser une ressource générée par LWUIT ... c'est bien mais le programmeur c'est toujours un gros parresseux donc... QUE FAIRE POUR UTILISER SES DEUX FONCTIONNALITEES EN MEME TEMPS, ... sachant que le code généré par le visual mobile designer de netbeans n'est pas retouchable dans l'outils lui même ???


COMMENCONS

1) Dans le repertoire "util" de votre décompression LWUIT se trouve "ResourceEdit.exe" Lancer cet outils et créez votre ressource LWUIT. C'est relativement simple, vou pouvez y arriver avec ou sans tutoriel. Ne vous préoccupez pas de l'aspect code de votre application, cet outils de LWUIT ne gère que le design donc concntrez vous sur le DESIGN. Si vous avez beoin d'un tuto malgrés tout alors consultez l'article de SUN mentionné plus haut. Pour notre exemple voici notre ressource nommé: gsk.res



2) Créez votre application javaME en utilisant Visual Mobile Designer de Netbeans

Concevez normalement le code de votre application. dans l'exemple notre application est très simplifiée. Au démarrage nous nous retrouvons devant un formulaire qui possède un menu à 3 item. l'un des item ferme l'application, voilà c'est tout mais suffisant pour voir les retouches qu'il faudra par la suite faire pour intégrer dans cette application notre design conçu avec lwuit designer.


3) Créer une nouvelle classe principale dans le repertoire de votre application et copier tout le code généré par le VMD à l’intérieur de cette nouvelle classe. Corriger les erreurs de nommage sur la nouvelle classe, sur son constructeur et enlevez les implements.

-> Ajoutez la librairie lwuit.jar dans votre projet

4) Notre travail consistera principalement à traquer les erreurs sur le code pour l’unifier avec le design conçu dans lwuit designer.

è Remplacer les importations (pas de lcdui dans les import) voici les import les plus necessaires :

import javax.microedition.midlet.*;

import com.sun.lwuit.Form;

import com.sun.lwuit.Command;

import com.sun.lwuit.events.ActionEvent;

import com.sun.lwuit.Display;

import com.sun.lwuit.plaf.UIManager;

import com.sun.lwuit.util.Resources;

import java.io.IOException;

è Dans la methode startApp() ajouter au debut ce code:

try {

Display.init(this);

Resources r = Resources.open("/gsk.res");

UIManager.getInstance().setThemeProps(r.getTheme("gsk"));

//gsk c’est le nom que vous avez donné au theme dans le fichier .res

} catch (IOException ex) {

ex.printStackTrace();

}

è Supprimer les methodes switchDisplay et getDisplay ou les mettre en commentaire

( /* */ )

è Ajoutez dans le code des methodes «get » le bout de code tel que mentionné en dessous :

public Command getScreenCommand1() {

if (screenCommand1 == null) {

screenCommand1 = new Command("Screen", 0)

{

public void actionPerformed(ActionEvent evt) { // CODE A INSRER }

};

}

return screenCommand1;

}

-> Regarder la methode commandAction() Il ya là les codes d’action pour chaque composant actif dans notre formulaire. Copier ces codes et insérer les dans les methodes actionPerformed() des methodes « get » correspondantes pour chacun des composants actifs du formulaire.

-> Dans la methode startMIDlet() remplacer le code par : getForm().show();

-> Corriger les petites erreurs de syntaxes restantes, s’il y’en a et executer votre application.



dimanche 27 décembre 2009

NetBeans 6.8 Java FX



L'edition de javaFX s'
améliore considérablement dans NetBeans 6.8 (comparer à NetBeans 6.7 notamment:

1. renommage (refactoring) des fonctions, classes, etc fonctionne comme en Java
2. le déplacement de classes entre les paquets de travaux (références / importations sont mis à jour) - également par simple glisser-déposer
3. trouver des usages / Remplacement des méthodes dans des projets open / projet de travaux en cours
4. Quick Fix pour par exemple œuvres importations (alt + Enter)
5. Ctrl + cliquez sur la navigation entre les catégories d'œuvres
6. Ctrl + O (aller au type) "recherche en texte intégral dans les types« œuvres
7. œuvres en format
8. "fixer les importations" œuvres
9. Nouvel écran de démarrage et les icônes des fichiers dans le projet :-) onglet

Un plugin est disponible en téléchargement a travers l'interface Netbean
(
NetBeans Update Center): C'est le JavaFX Composer .

NetBeans 6.8 Java editor FX a été grandement améliorée, en le comparant avec NetBeans 6.7. Les ajouts apportées améliorent de façon significative la productivité. Ne manque que les tables, des arbres et des composants plus sophistiqués.

La grande question : C'est pour quand le
concepteur visuel javaFX ? vivement la suite.

Netbeans 6.8 intègre un support pour Symfony. Symfony est un Framework utilisé par de nombreux developpeurs PHP. Un plus qui ne se refusera pas.

  • Auto-complétion dans les vues
  • Raccourcies pour le passage Action->Vue et Vue->Action
  • Accès rapide aux commandes Symfony
La nouvelle version ce netbeans integre aussi son propre IDE pour javaFX. On se souvient que ce dernier n'etait pas present dans la version 6.7 et qu'il fallait s'en remettre à celle developpez pour la version 6.5.
Ainsi Netbeans se rapproche encore plus de ses utilisateurs. Rendez vous sur netbeans.org


samedi 19 septembre 2009

Introducing J2ME Polish

J2me Polish SlideShare Presentation:

vendredi 7 août 2009

SECURE YOUR MOBILE APPLICATION

SECURE YOUR MOBILE APPLICATION

MIDP and Security

It may sometimes be essential to secure your mobile applications designed to protect users against prying. It is for the programmer to ensure that:

- That its program has the necessary permissions for its proper fonctionnemlent

- If the code was compiled to be decompiled it is "fuzzy", confused.

- Identify the application to the user.

To accomplish these tasks I will show you how Netbeans IDE life easier.

Obfuscation

Obfusquation may mean making dark, confused, blurred. Programmers use the term to designate a code hard to read and maintain. There are many free and paid obfuscator soft. The obfuscation as you will understand is used to make the source code difficult to understand and therefore to mitigate the existence of decompiler. an obfuscation only affects the files. class and not on the source files. After an obfuscation weight of the application can be reduce ... what appears to be a good advantage. The obfuscation is to be made before the prévérification in the sequence compilation of your application. Netbeans IDE includes a free obfuscation (Proguard) whose use is very simple.

You just go to the project properties - obfuscating - Obfuscation Level. Whenever you move the gauge you can read the description of the corresponding level of obfuscation. After you just say OK.


Remember that the Obfuscation is when you are in production phase of your program and not being debugging. Always test your application after obfusquer, there may be derangements for example relating to the level of obfuscation that you define.

API access to protected

For its proper functioning program will often use permissions. One example for a right of access to files, the mobile information (File Browser, PIM API) is also the case for a connection to the Internet. The programmer must provide such permissions. The MIDP 1.0 specification does not the permissions if you can say it like that. MIDP 2.0 is quite flexible against. Permissions set in the descriptor of the application (. Jad) through attributes MIDlet-Permissions for required permissions and MIDlet-Permissions-opt for the optional permissions. When the permissions problem is detected when launching an application that it produces an SecurityException.

With Netbeans IDE, adding a permission can be done by going to properties - Application Descriptor - API Permissions - Add - Select your permissions. Depending on whether you check or uncheck "required" or your permission is not considered optional. Netbeans will add the attributes in question. Jad (application descriptor)

-

Everything goes as before the application specified the rights (permissions) and it wishes to have clarified the identity of the user through the use of digital certificate.

Signature of the application

A certificate is like the card application identity, the link between the physical entity (author) and the virtual entity (the application). the standard most often used to produce the X509 certificates.

We will use Netbeans IDE for signing our application. To do this we find in the Properties - Signing - Keystore - Alias. There are several areas to protect, select the certificate for the domain that fits your goals:

- Minimum all permissions are denied (OTA is a result of a failure).

- Trusted: all are accepted without permissions of the user intervension

- Untrusted: permissions granted after agreement of the user

Then export the key to the emulator to test your application.

Choose the field and click OK. Now your application is signed. The certificate was exported to the emulator for your application to be tested. Indeed, if your device does not recognize the certificate there is no valid reason to achieving the installation. You can create your own certificates (where you put your personal information for the signature) to open keystores manager. Then follow the steps as presented in the diagram below. (Note: Step 7 is not required)



The award of this certificate produced a jad having the following attributes (color)

-------------------------------------------------- -------------------------------------------------- ---------------------------------

MIDlet-1: PIM Browser Example, / org / netbeans / desktop / resources / dir.png, pimbrowserexample.PIMBrowserExample

MIDlet-Certificate-1-1: MIICYTCCAcqgAwIBAgIESn8frjANBg .. [number!] ... etc.

MIDlet-Jar-RSA-SHA1: BLSTv7epKRxVrFCmAcBIBsXRXg .. [number!] ... etc.

MIDlet-Jar-Size: 73547

MIDlet-Jar-URL: VotreMIDlet.jar

MIDlet-Name: Visual Designer Custom Components

MIDlet-Permissions: javax.microedition.pim.ContactList.write, javax.microedition.pim.ContactList.read,

... etc.

-------------------------------------------------- -------------------------------------------------- ---------------------------------

If you have not export the certificate in the emulator, when running you get an error message like:

-------------------------------------------------- --------------------------

Starting emulator in execution mode

Installing result from: http://127.0.0.1:1254/VotreMIDlet.jad

[WARN] [rms] javacall_file_open: _wopen failed for C: \ Documents and Settings \ be \ javame-sdk \ 3.0 \ work \ 0 \ appdb \ _delete_notify.dat

*** Error ***

A problem occurred during application from deploying http://127.0.0.1:1254/VotreMIDlet.jad

Reason:

The content provider certificate issuer C = Cameroon; ST = State, L = Location, O = Greenspirit; univa1109 OR =, CN = benycertif is unknown.

-------------------------------------------------- --------------------------


This message tells you clearly that the certificate is not recognized, in other words your application has an identity card which does not permit. add your certificate through the wireless toolkit that it is recognized. just like you do with your browser. But the "_delete_notify.dat" WARNING can have another cause : Try to see here: http://greensspirit.blogspot.com/2011/05/warn-rms-javacallfileopen-wopen-failed.html

This post has quickly explained the possibilities of securing your MIDlets and showed you how to do it easily with Netbeans IDE.

that's that....


mercredi 5 août 2009

PIMP YOUR MOBILE SVG USER INTERFACE

PIMP YOUR MOBILE SVG USER INTERFACE

[sorry for english mistake]
About Netbeans and SVG
Netbeans IDE give you a simple way for using SVG API in your mobile application. By using SVG tool include in Netbeans IDE, SVG User Interface look very simple to be implemented. in fact Netbeans have two tools for doing that, SVG Components and SVG Form Components. But the design of these components may not satisfy you if you like high quality design. In this tutorial, I want to show you how you can add your own SVG component in Netbeans palette and use it in your application without any problem.

Make your SVG file out of Netbeans
You can find many SVG editor software on the web. For mobile designing you can use Ikivo animator or Mobile Designer Beatware like you can see in this image.

If you use Mobile Designer Beatware (I think it's the same for Ikivo) the simple thing you have to do is to drag and drop image on the work space and then convert that image to button by right clicking. After that you have to rename the "Button1" by "button_1". you have the possibility to animate your new button like you want. For example one of my button will grow when
the cursor move on.
[according to the software you use try to read the help for achieving this thanks]

Don't forget that when you will export your SVG file, the profile MUST BE SVG Tiny 1.1.
I have also made a simple SVG animation that i will add to Netbeans palette.
You can download the 2 SVG animation of this tutorial here.

-----LINK------

but.svg is the animation file for les button and gspirit.svg is the simple file logo's animation .

Work with Netbeans IDE
Put that two SVG files on your Netbeans mobile application project. Right Click the new SVG file node - copy - right click on the Netbeans palette - click palette manager - select Form components - right click - paste item. Your new item will appear. Now you can use it like all other Components deliver by Netbeans SVG Form Components palette.

Use visual Mobile Designer tool and add SVG Form item on your work space.
Now create new SVG file on your project. name it "formCustom.svg" Drag and drop the new SVG form component item that you have just add to palette.
Drag and drop the but.svg file project node on the Netbeans SVG editor space. Now you must have something like this.

Go to formCustom.svg file source code and everywhere you see
(x is an integer exemple: ) cut "id="button_x" and paste it at the end of tag. you must have this result:
-----------------------------------------------------------------------------------------------------------------------------------

<use x="-73" y="-50" xlink:href="#ipod.png"
transform="translate(-28.37,48.81) scale(0.625,0.65625)" id="button_1">
------------------------------------------------------------------------------------------------------------------------------------
Do it for all the three buttons.
now go to your Visual Mobile Designer file - drag and drop the formCustom.svg file over the SVG form item on your work space. If evrething is good you must see your new button be recognized by Netbeans IDE.

I have already write tutorial in this blog where i explain how to manipulate svg button. try to read this tutorial.
You can Run the project and see how your new SVG UI can be more attractive than UI which only use SVG elements present in Netbeans.

NOTE: You can do the same with the SVG menu component, then you will substitute "button_x" to "menu_x" ... something like this.
Give your comments and suggestions.
Thank for reading.