BlackBerry Simulators Reference Guide for Eclipse 3.5 plugin
February 26th, 2010I have been using the BlackBerry Java® Plug-in for Eclipse® v1.1 on Eclipse 3.5 (Galileo) for a while, using the various simulators that are available in the various component packs. The base BlackBerry Plug-in comes with the 5.0.0 component pack, but others can added as additional plugins for Eclipse.
During development I often want to try using different combinations of simulators and JREs, but couldn't find any quick references relating which simulators are available for which component pack. I have compiled a reference guide to help myself with this, and hope others will find it helpful as well.
Before providing a reference guide to the simulators available, here is a quick start guide to get going in Eclipse.
- Download and install Eclipse 3.5 (Galileo). I used the EE package.
- Download the BlackBerry Java® Plug-in for Eclipse® v1.1
- Install the plug-in, pointing it to your Eclipse installation.
- In Eclipse->Window->Preferences->Install/Update->Available Software Sites add the following site: http://www.blackberry.com/go/eclipseUpdate/3.5/java
- In Eclipse->Help->Install New Software, using the Software site added above and download the desired Component Packs.
- Restart Eclipse after installing plugins
Simulator Reference Guide
Component Pack: 5.0.0.14
Blackberry (JRE) version: 5.0.0
| Device | Family | Display Screen Size | Interaction Method |
| 9000 | Bold | 480x320 | trackball |
| 9550 | Storm | 360x480 | touch screen |
| 9700 | Bold | 480x360 | trackball |
Component Pack: 4.7.0.53
Blackberry (JRE) version: 4.7.0
| Device | Family | Display Screen Size | Interaction Method |
| 9500 | Storm | 360x480 | touch screen |
| 9530 | Strom | 360x480 | touch screen |
Component Pack: 4.6.1.36
Blackberry (JRE) version: 4.6.1
| Device | Family | Display Screen Size | Interaction Method |
| 8350i | Curve |
320x240 |
trackball |
| 8900 | Curve |
480x360 |
trackball |
Component Pack: 4.6.0.21
Blackberry (JRE) version: 4.6.0
| Device | Family | Display Screen Size | Interaction Method |
| 9000 | Bold |
480x320 |
trackball |
Component Pack: 4.5.0.21
Blackberry (JRE) version: 4.5.0
| Device | Family | Display Screen Size | Interaction Method |
| 8100 |
Pearl |
240x260 |
trackball |
| 8110 | Pearl | 240x260 | trackball |
| 8120 | Pearl | 240x260 | trackball |
| 8130 | Pearl | 240x260 | trackball |
| 8300 | Curve | 320x240 | trackball |
| 8310 | Curve | 320x240 | trackball |
| 8320 | Curve | 320x240 | trackball |
| 8330 | Curve | 320x240 | trackball |
| 8700-black | Electron | 320x240 | trackwheel |
| 8703e | Electron | 320x240 | trackwheel |
| 8800 | 88XX | 320x240 | trackball |
| 8820 | 88XX | 320x240 | trackball |
| 8830 | 88XX | 320x240 | trackball |
Component Pack: 4.3.0.17
Blackberry (JRE) version: 4.3.0
| Device | Family | Display Screen Size | Interaction Method |
| 8120 | Pearl |
240x260 |
trackball |
| 8130 | Pearl | 240x260 | trackball |
Component Pack: 4.2.1.19
Blackberry (JRE) version: 4.2.1
| Device | Family | Display Screen Size | Interaction Method |
| 7130 |
7130 |
240x260 |
trackwheel |
| 7130e | 7130 | 240x260 | trackwheel |
| 8100 | Pearl | 240x260 | trackball |
| 8700-black | Electron | 320x240 | trackwheel |
| 8700-blue | Electron | 320x240 | trackwheel |
| 8703e | Electron | 320x240 | trackwheel |
| 8707 |
Electron | 320x240 | trackwheel |
| 8800 | 88XX | 320x240 | trackball |
Adding Style and Color to Blackberry Labels
February 16th, 2010The Blackberry API provides the RichTextField class to allow for different styles, and the ActiveRichTextField to add color. When I first tried using them I found them not very easy to figure out. After playing around for a while, and finding a few examples I was able to figure it out. To help others get started I have put together this little tutorial/example.
In this example, I will show how to created the following formatted text:
This is formatted text, containing bold, and italic text, as well as blue and red text.
First, we define the text we want to format as a String:
Code:
String text = "This is formatted text, containing bold, and italic text, as well as blue and red text."; |
The RichTextField formatting, is based on defining the regions of the text that should be formatted. These regions are defined by offsets within the String. So next we need to define an Array of offsets that set the boundaries of the regions we want to format. It is important to set the first offset as the beginning of the text and the last offset as the end of the text (i.e. the must always be at least two offsets). The offsets can be specified as hard coded integer offsets, but this is not very maintainable. I try to define the offsets using the indexOf() method in the String class, as the following shows:
Code:
int[] offsets = new int[10]; | |
offsets[0] = 0; //This is the beginning of the text | |
offsets[1] = text.indexOf("bold"); | |
offsets[2] = text.indexOf("bold") + "bold".length(); | |
offsets[3] = text.indexOf("italic"); | |
offsets[4] = text.indexOf("italic") + "italic".length(); | |
offsets[5] = text.indexOf("blue"); | |
offsets[6] = text.indexOf("blue") + "blue".length(); | |
offsets[7] = text.indexOf("red"); | |
offsets[8] = text.indexOf("red") + "red".length(); | |
offsets[9] = text.length(); //End of the text |
Now we have or text chunked into all the necessary regions. The next step is to define the Font styles and Colors we want to use for the formatting.
When using a RichTextField with only Fonts (no Colors) it is relatively straight forward. You create an Array of Fonts and then define an Array of Attributes that link an Offset to a Font. When using both Font styles and Colors these attribute must be thought of as Font style/Color pairs. The easiest way to try to set this up is to set up a grid. For our example the grid could be as follows:
| Offset | Font | Color | Attribute Value |
| 0 | PLAIN (default) | BLACK | 0 |
| 1 | BOLD | BLACK | 1 |
| 2 | PLAIN (default) | BLACK | 0 |
| 3 | ITALIC | BLACK | 1 |
| 4 | PLAIN (default) | BLACK | 0 |
| 5 | PLAIN (default) | BLUE | 3 |
| 6 | PLAIN (default) | BLACK | 0 |
| 7 | PLAIN (default) | RED | 4 |
| 8 | PLAIN (default) | BLACK | 0 |
In this grid I first laid out the offsets, then defined the Font style/Color pair I wanted for each offset. I then went and gave each unique pair an incremental attribute value. I can then use this attribute value to set up the Font and Color arrays:
Code:
Font[] fonts = new Font[5]; | |
fonts[0] = Font.getDefault(); | |
fonts[1] = Font.getDefault().derive(Font.BOLD); | |
fonts[2] = Font.getDefault().derive(Font.ITALIC); | |
fonts[3] = Font.getDefault(); | |
fonts[4] = Font.getDefault(); | |
| |
int[] foregroundColors = new int[5]; | |
foregroundColors[0] = Color.BLACK; | |
foregroundColors[1] = Color.BLACK; | |
foregroundColors[2] = Color.BLACK; | |
foregroundColors[3] = Color.BLUE; | |
foregroundColors[4] = Color.RED; |
Once I have created the Fonts and Colors I create the Attributes Array to link the Font style/Color pairs, to the Offsets.
Code:
byte[] attributes = new byte[9]; | |
attributes[0] = 0; | |
attributes[1] = 1; | |
attributes[2] = 0; | |
attributes[3] = 2; | |
attributes[4] = 0; | |
attributes[5] = 3; | |
attributes[6] = 0; | |
attributes[7] = 4; | |
attributes[8] = 0; |
Finally once all of the Offsets, Fonts, Colors and Attribute are defined, we can create an instance of our class:
Code:
ActiveRichTextField formattedTextField = new ActiveRichTextField(text, offsets, attributes, fonts, foregroundColors, null, Field.NON_FOCUSABLE); |
In this example, I didn't want to do anything to the background color so I passed in null, I also wanted this field to act as a simple label, so I set the field as non focusable.
This field can then be added the screen.
A few things to watch out for:
- Make sure the offsets array contains an element for the start of the String and an element for the end of the String.
- The length of the attributes array should be one less than the length of the offsets array.
- Make sure the length used in the definition of the array, matches the actual number of elements you include; it is easy to go added a font element, but forget to change the value in the array definition. This will lead to ArrayIndexOutOfBounds Exceptions.
- In your attributes array, make sure you have corresponding elements in your font/color arrays for each value you set. For example, setting attribute[8] to 5 would be a problem since there isn't a fifth element in the font or color arrays.
This may not be the only way, or even the best way to accomplish this, but it worked for me, and hopefully some people find this helpful.
Check out the great deal in
Electronics
at Best Buy!
How to get rid of DAO.msi pop up, after installing Roxio Media Manager
February 12th, 2010I recently installed Blackberry Desktop Manager 5.0, and then as part of that, installed Roxio Media Manager. Ever since, I would get sporadic pop-ups looking for DAO.msi to install. I tried to find a way to get rid of this annoying problem, and most solutions I found told me to unregister and then re-register the .dll as follows:
Unregister:
- On the taskbar, click Start > Run.
- In the Run dialog box, type the following:
regsvr32 /u "C:\Program Files\Common Files\Microsoft Shared\DAO\dao360.dll - Click OK.
Register:
- On the taskbar, click Start > Run.
- In the Run dialog box, type the following:
regsvr32 "C:\Program Files\Common Files\Microsoft Shared\DAO\dao360.dll" - Click OK.
I tried this, but it didn't work.
I also read about solutions to reinstall Microsoft Office, but I never had Office installed.
I think the problem I had, came from having an ATI video card a while back, and then I switched to an NVidia card and in the process I uninstalled my ATI software.
The solution I finally found to work, was to go to the ATI/AMD site and download and install the DAO/MDAC which is part of ATI Multimedia Center.
The link to download is here: http://support.amd.com/us/gpudownload/Pages/mmc9-14.aspx
This link may change, so the way I found it was to go to ATI/AMD driver site. I then searched for drivers for Windows XP Professional/Home, All-in-Wonder, All-in-Wonder Radeon Series. I then went to ATI Multimedia Software, which includes 4 components. I downloaded component 1: DAO/MDAC (9-14_mmc_uci.exe). After installing this, my problem went away.
Hopefully this can help someone else who is facing this annoying problem.
My System: Windows XP Pro SP3
PWMinder Going Mobile
January 29th, 2010
PWMinder is a cross-platform Password Management System, that allows users to securely store and manage all of their personal password information. Currently PWMinder can run on Windows, Linux and Mac (intel), and the password repository files generated are portable from one platform to another. For example, a password repository file could be created on a Windows computer; the file could then be moved to Mac, opened, edited, and then moved to a different Windows computer to be accessed.
This is great if all you use are desktop computers, but what about password management on your mobile devices, such as a Blackberry or iPhone? Good new! Development is currently underway to create PWMinder for the Blackberry, with plans to follow up with a version for iPhone/iPod. If there is demand, versions may also be created for Android phones and/or Palm devices.
Once complete, a users could create a password repository at work on a Windows desktop, copy the file to their Blackberry to access passwords on their way home. They could then copy the file to their Mac at home, add a few more passwords, then copy the file to their iPhone for use on the weekend. With PWMinder you will be able to have access to all of your passwords, no matter what platform, OS, or handheld device you are on!
Planned features for PWMinder on the Blackberry:
- Password records can be organized into Categories
- Ability to search for password records
- Easy copying of logins and passwords
- Open web links directly from within PWMinder
- Reminders for password expiry can be added to you calendar or todo list
- Includes a Password Generator tool to create secure passwords
If you have any other ideas for what you would like a Password Manager to do for you, on the mobile device, either add comment to this blog, enter a suggestion on the Ewert Technologies support page.
PWMinder on the Blackberry should be available at the end of March, 2010 with development of PWMinder for the iPhone to follow. Stay tuned for updates.
iPhone Accessories! Get them while they're HOT!
Installing Cross-Platform Java Applications on a Budget
January 4th, 2010
Note: this article originally appeard in the December 2009 issue of ASPects, The Monthly Newsletter of the Association of Shareware Professionals.
As most Java developers have come to realize, one of the most challenging aspects of developing cross-platform Java applications, is how to deploy them, in the most native way possible, to their various target platforms e.g. Windows, Linux and Mac. There are several commercial solutions available, but these cost in the range of $500 to $2000, which may be a bit steep for an independent software developer. In this article, I will provide an overview of how I approached this problem, while developing PWMinder, using a combination of open source tools; and I hope this will provide a framework for those of you facing similar issues.
In my search for a free solution, the first thing I had to accept was, that no single solution would meet all of my needs, and instead, I would need to us a combination of different tools. This approach requires a lot more work than would be needed using a commercial solution, but this is the price for having something for free. The following are the tools I used to create the installers.
Apache Ant
Most Java developers should be familiar with Apache Ant. It is a build tool that comes with many built-in tasks, for things such as moving and deleting files, creating folder structures, archiving files, etc., to build and packages applications. While it can be used for building any kind of software, it is targeted for Java applications and includes tasks to compile Java code, create jar files, create Javadoc API documentation, etc. Apache Ant is also extensible, and custom tasks can be created for it. Many third party tools can be incorporated directly into Ant by using their supplied tasks. In my process of creating cross-platform installers, ApacheAnt serves the main control center.
Launch4j
Launch4j is a tool that wraps an executable .jar file into a native Windows executable (.exe). Using Launch4j you can set an icon for your .exe, set Windows file manifests, create a native pre-JRE splash screen, set both environment variables and Java runtime parameters, and more. Launch4J come with a GUI front end, that is used to set up the configuration parameters. This configuration is saved as an .xml file that can also be edited by hand. Launch4j comes with an Ant task, and can, therefore, be easily integrated into an Ant script. When launching from an Ant script, variables defined in the Ant script, such as build number, etc., can be passed in to Launch4j, providing even more flexibility. Launch4j basically allows your executable .jar file to act like a Windows .exe.
NSIS
NSIS is a tool used to generate standard Windows based installers. NSIS is script based and is quite powerful, allowing for a lot of flexibility when creating an installer. I found that this flexibility comes with some complexity, and found there to be a bit of a learning curve when it comes to using NSIS scripts. Having said that, there are many examples available, that can help to set up a basic installer quite quickly. The installer allows for creation of Windows short cuts, creation of an uninstaller, adding and/or updating Windows registry settings. During the install, It can display panels prompting users for install location, display an license screen and even start he application when the installer has completed. As mentioned NSIS is script based, and while you can use any text editor, I would recommend either using EclipseNSIS (plugin for Eclipse) or HM NSIS edit, which both include wizards to help get you started. While NSIS does not come with Ant task, it can be run from Ant, using Ant's ability to execute commands.
JarBundler Ant Task
JarBundler is an Ant extension that is used to create a Mac .app bundle from an executable .jar file, which can be used to run a Java application on a Mac. An .app bundle is basically a specialized folder structure containing resources, and configuration information to run an application. When this folder is copied onto a Mac, it appears as a file that is used to start the application. JarBundler is configured within an Ant script as an Ant task. The configuration is quite extensive and allows you to control many properties of the .app bundle including its icon, version, working directory, help book location and more. Most of these properties are mapped to bundle variables defined in Mac OS X Runtime Configuration Guidelines (http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPRuntimeConfig/Runtime_Configuration.pdf)
IzPack
IzPack is a cross-platform installers that creates an installers as an executable .jar file. Similar to NSIS, it allow for panels to display license information, select installation folder, etc. It also includes a utility to create short cuts for both Windows and Unix, and supports creating an uninstaller. Both the installer and uninstaller are .jar files, however, which may not be what users are expecting when installing software. IzPack is configured using one or more xml files and can then be executed within Ant using an IzPack task. While it can create installers for Windows, the installer produced by NSIS looks more native and has more Windows specific features, which is why for Windows I use NSIS.
The Diagram below gives the basic flow I used to create the installers.

The first step is to use Ant, to compile the Java source, generate an executable .jar file (app.jar in the figure above) and collect and organize any other files necessary for the application (e.g. library .jar file, and support files such as user guide, release notes, license files, images, etc.) into a staging area. Starting from app.jar, the library and support files, the paths for each Operating System diverge.
On Windows, most user would expect to download an executable (.exe) setup file, which when executed, would launch an installation wizard, that would lead them through a set of steps to install the application. The application itself would be available also as an .exe, and shortcuts would be generated in the Start menu. To accomplish this, I first used Launch4j, to convert the app.jar file to a Windows .exe file (app.exe). Next, using Ant, I organized app.exe with any necessary library .jar file and support files into a staging location. I then used NSIS to to create an installer (setup_win.exe) which, when run creates the short cuts, uninstaller, registry entries, etc. The user can then download setup_win.exe directly and run it.
Linux users are a little more relaxed about how to install software, but I still wanted something more professional, than to simply unzip the files to a desired location. For Linux, I kept app.jar as it is, and created a bash script to execute it. Next, using Ant, I organized app.jar with any necessary library .jar files, the bash script and support files into a staging location. I then used IzPack to create the installer, as setup.jar file. Rather than have the user download a .jar file, which they may not be as familiar with, I put the setup.jar file into a .tar.gz file. The user would download the setup_lin.tar.gz file and extract setup.jar file. They would then run the setup.jar, which would install the application and create shortcuts. The user can then either start the application using the short cuts created or by running the bash scripts.
On Mac, users expect use .app bundles to run their applications. So for Mac deployment, I used the ant based utility call JarBundler to convert app.jar, to a an .app bundle (app.app). I then used IzPack to take app.app, the library files, and the support files and create an installer .jar file (setup.jar). I then used IzPack's own utility to convert this setup.jar to an installer .app (setup_mac.app). Lastly, to facilitate downloading of the setup_mac.app folder structure, I put it into a .zip file (setup_mac.zip). The user would download the setup_mac.zip file, extract the setup_mac.app. They would then run setup_mac.app which would install the application, including app.app. To run the application the user would then double-click the app.app, just as they would for any other application they have.
While there are a lot of steps involved, what is nice about all of the above tools is that they can be all integrated into Apache Ant, so at the end I can compile the code, create the executable .jar file, organize the files and then create the installers for Windows, Linux and Mac, all from one Ant script.
Resources
Apache Ant - http://ant.apache.org/
Launch4j - http://launch4j.sourceforge.net/
NSIS - http://nsis.sourceforge.net/
JarBundler Ant Task - http://informagen.com/JarBundler/
IzPack - http://izpack.org/

