Wednesday Jun 17, 2009

My notes for Ubuntu 9.04 64b

My hard drive crashed therefore I received a new one. It means reinstall the Ubuntu 9.04 again. This post shgould be gathering of the steps necessary for me to start work again.

Tuesday Nov 06, 2007

[TIP] WTK 2.5.1 and Debian

There were a few reports about Mobility Pack problems on Debian linux distribution. The mobility project didn't preverify during the build of project. You can following message in output window
Created dir: /home/user/MyHello/build/preverified
Preverifying 6 file(s) into /home/user/MyHello/build/preverified directory.
/home/user/.netbeans/5.5.1/emulators/wtk251-lin/emulator/bin/preverify1.1: /lib/tls/ version `GLIBC_2.4' not found (required by /home/user/.netbeans/5.5.1/emulators/wtk251-lin/emulator/bin/preverify1.1)
/home/user/MyHello/nbproject/build-impl.xml:269: Preverification failed with error code 1.
BUILD FAILED (total time: 1 second)

This problem happens with the Wireless Toolkit 2.5.1 that is bundled with NetBeans Mobility Pack 5.5.1. It was reported by some users. We couldn't fixed it in Mobility Pack itself because it is problem of the WTK emulator platform. Therefore we reported it to the WTK team. It should be fixed in the WTK version 2.5.2. Unfortunatelly, I'm not able to verify the fix in the WTK because I don't have any machine with Debian.

Debian users should install the WTK 2.5.2 or they can use the latest builds of NetBeans Mobility pack 6.0 that is bundled with WTK 2.5.2

Tuesday Sep 18, 2007

[TIP] User Code in Component Properties

When you are creating an application in Mobility Pack Visual Designer you probably use the Properties to change texts and other properties of the components used in your midlet. The Properties window is opened by default in right bottom corner of the Visual Designer. The Properties window shows the properties of selected component either in Flow/Screen Designer view or in Inspector/Navigator.

When the property name is in bold then the property doesn't have the default value. It means that you (or the IDE) changed it. The same approach is used by the Properties window in Matisse GUI Designer.
Look at the String, Timeout, Title, Instance Name properties at the picture on right side.

You can change Title of component, you can change the text shown etc. There are two ways how to do it.
The first one is to use a string that you write to the appropriate property of the component - e.g. .

The other option is to open Property editor(PE) of a property by click on the three dots button. In the PE you can use your User Code to assign the value to the property.

Property Editor in 5.5.1

Property Editor in 6.0
The generated code for the user code value of the property from the pictures above will look like
    public Alert getAlert() {
        if (alert == null) {
            // write pre-init user code here
            alert = new Alert("My Little Alert", LocalizationSupport.getMessage("licenseincorrect"), null, null);
            // write post-init user code here
        return alert;

Thursday Sep 06, 2007

[TIP] Filtering classes in distribution jar

The size of the jar is important in Java ME world. When you want to filter out some files from the final distribution jar you can do it in project properties of the Mobile project. You can set up filtering for every configuration of your project. You set up what classes should be include and what excluded with check boxes in classes tree.

some classes are filtered out

As you can see on the image the unchecked classes will not be included in the configuration. They will be filtered out from the whole build process. In a different configuration you can filter out different classes etc. In this way you can have different versions of your project or library.

Wednesday Aug 22, 2007

[TIP] Select Category For Installation In Plugins Dialog

Yes, it might seem easy when you know it. However it took me long time to use the right click to the Plugins dialog. It might help you.

Popup menu in plugins dialog

I haven't seen popup in any of the NetBeans dialogs. Is it change of UI behavior? IMHO, it's unintuitive. We used to teach the NB user something for long time. Now we are changing it. Why?

Saturday Aug 18, 2007

[TIP] Using SVG Menu In Visual Designer

The SVG Support in NetBeans Mobility Pack give you new SVG aware components. I already blogged about the SVG support and created a short flash demo.
I'd like to explain how to work with the SVG menu component in this blog entry.

There is SVGMenu component in the palette of Visual Designer in Mobility Pack. You can add SVG Menu Element to the SVGMenu. The SVG Menu Element can be then bind to an element with ID in the SVG image.
	<text id="menuItem_0" ... >
You can do it either manually in Properties of a SVG Menu Element by naming the SVG Menu Element exactly same as the ID or you can follow the SVG Menu Item pattern when creating IDs of the elements in your SVG image. The pattern is "menuItem_NUMBER". When you assign a SVG image with IDs that follow the pattern to the SVGMenu component then the SVG Menu Elements will be created automatically for you. You can watch screencast to see it in action.

SVG Menu Screencast Demo Flash

Tuesday Jul 31, 2007

[TIP] Generate Values to JAD During Build Process

Sometimes you need to modify the build process of your project. There is build.xml file in your project directory that drives the build process. To open it in NetBeans, you have to switch to Files view (at least in Mobility project type). When you open it in the editor you might be surprised that there is only an import of build-impl.xml file and a comment in this file. Yes, the main build targets are defined in build-impl.xml file but you should never modify it because it's a generated file. If you want to add a build target or modify/overwrite an existing one you should do it in the build.xml

You don't have to overwrite the existing targets. There are defined following empty targets that you can define in your build.xml. And they will be run in the right time in your build process.

Defined pre/post targets:
  • pre-init: called before initialization of project properties
  • post-init: called after initialization of project properties
  • pre-preprocess: called before text preprocessing of sources
  • post-preprocess: called after text preprocessing of sources
  • pre-compile: called before source compilation
  • post-compile: called after source compilation
  • pre-obfuscate: called before obfuscation
  • post-obfuscate: called after obfuscation
  • pre-preverify: called before preverification
  • post-preverify: called after preverification
  • pre-jar: called before jar building
  • post-jar: called after jar building
  • pre-clean: called before cleaning build products
  • post-clean: called after cleaning build products

Generate Values to JAD during build process
You need to know what target you want to override, of course. I found out from the build-impl.xml file that the jad is created as part of the jar target. Therefore I will define the post-jar in my build.xml.

Modified build.xml :
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->>
<project name="" default="jar" basedir=".">
    <description>Builds, tests, and runs the project .</description>
    <import file="nbproject/build-impl.xml"/>
    <target name="post-jar">
        <!-- add all properties that you want to the JAD file -->
        <nb-output file="${dist.dir}/${dist.jad}" encoding="UTF-8" append="true">Lukas_property_1: Blablabla
        <nb-output file="${dist.dir}/${dist.jad}" encoding="UTF-8" append="true">Lukas_property_2: ${name}

Please note that the not-intended </nb-output>. It's by purpose. The nb-output task copies the text as it is to the file.

The jad file will look like :
MIDlet-1: VisualMidlet, , VisualMidlet
MIDlet-Jar-Size: 62157
MIDlet-Jar-URL: MobileApplicationSVG.jar
MIDlet-Name: MobileApplicationSVG
MIDlet-Vendor: Vendor
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.1
Lukas_property_1: Blablabla
Lukas_property_2: MobileApplicationSVG 


Wednesday Mar 28, 2007

[TIP] Using ColorSchema for TableItem

There is custom component TableItem available in palette of NetBeans Mobility Pack. It was added in version 5.0 of the Mobility Pack. Later we discovered that the TableItem displays in black color only on some devices - e.g. BlackBerry. There are issues filled for those problems 79625, 80447.

The "all in black" problem is mostly caused by the wrong return values of getDisplay().getColor(Display.COLOR_\*);. It returns 0 for all the Display.COLOR_\* constants on BlackBerry.

This issue can be solved in Mobility Pack 5.5 (and later) with ColorSchema class. Look at the image on the right side. The table looks definitely better.
You can specify what ColorSchema should be used by your TableItem by calling method aTableItem.setColorSchema(ColorSchema schema);.

Example of ColorSchema Usage

I will define a ColorSchema first.
ColorSchema myOwnColorSchema = new ColorSchema() {
            public int WHITE = 0xffffff;
            public int BLACK = 0x000000;
            public Image getBackgroundImage() {
                return null; //there won't be any background image
            public int getBackgroundImageAnchorPoint() {
                return 0; //there won't be any background image
            public int getColor(int aColorSpecifier) {
                switch (aColorSpecifier) {
                    case Display.COLOR_BACKGROUND:
                    case Display.COLOR_HIGHLIGHTED_FOREGROUND:
                        return WHITE;
                    case Display.COLOR_HIGHLIGHTED_BACKGROUND:
                    case Display.COLOR_BORDER:
                    case Display.COLOR_HIGHLIGHTED_BORDER:
                    case Display.COLOR_FOREGROUND:
                        return BLACK;
                        return BLACK;
            public boolean isBackgroundImageTiled() {
                return false;//there won't be any background image
            public boolean isBackgroundTransparent() {
                return false;//there won't be any background image

The ColorSchema is abstract class therefore you have to implement its methods when you are creating it.

Then I'll use the color schema for my TableItem. It's highly recommended to access the components used in Visual Design by the getter methods(get_).

You can download sample project. It shows how to use the ColorSchema. It will display the settings of your device too.

Tuesday Jan 02, 2007

[TIP] Add Attribute to JAD/Manifest

When you need to add a new attribute to your JAD or manifest file you can set it up in project properties of a project in NetBeans Mobility Pack.

Open "File | YourProject Properties" (or right clict to project and choose "Properties". Then select "Application Descriptor | Attributes". You can add new attributes or edit/remove the existing ones. You can specify whether your attributes will appear in JAD or Manifest (or in both).

You can define different set of attributes for different configurations.

Tuesday Dec 12, 2006

[TIP] Setup Proxy in Application Server

I'm hidden behind a firewall. I do use proxy to get to the internet. Therefore I do have to setup proxy in application server sometimes (when I use the appserv) - either glassfish or Sun Application Server.
It's easy to set it up but I often forgot the parameters. It's worth to save it into this blog entry.
You have to set up following parameters in Application Server node, tab JVM Settings | JVM Options
  • -Dhttp.proxyHost
  • -Dhttp.proxyPort
I prepared a short flash demo for those that would like to see where to set it up

This is the main channel to share news, tips and other stuff related to my work. Sometimes you can find even personal stuff. Enjoy your reading...


« July 2016

No bookmarks in folder