CDC Development with Mobility Pack (5 Minutes)
This demo showcases the CDC development with Matisse GUI builder and Mobility Pack.
Product Versions Supported
Points to Hit
- New CDC devices are coming, they're more powerful and allow developers to use AWT or even Swing on mobile devices.
- Thus mobile development is getting closer to Java SE development.
- Install NB 6.0 beta1 or higher with Mobility Pack.
- Get Wireless toolkit for CDC from here and install it.
- Set up Wireless toolkit for CDC in NetBeans using Tools | Java Platforms | Add platform | CDC | Find directory where you installed CDC WTK.
We're at Beta, anything can go wrong.
- Create a new application using New Project | Mobility | CDC Application. GUI Builder is opened.
- The goal is to create following application:
- Resize the form to a rectangle with sizes as you can see on the screenshot above.
- Drag & drop a tabbed pane.
- Drop two tabs on the tabbed pane and change the tab names to Contact and Other.
- Add a panel.
- Change it's border to Titled border and change the name to Personal.
- Create three labels and textfields for firstname, surname and nickname.
- Add the second panel.
- Change it's border to Titled border and change the name to Address.
- Add a label for Address:
- Add a textarea for address.
- Change the number of colums to 15 so that the textarea doesn't have scrollbars in the design view.
- Add OK and Cancel buttons.
- Select both and use the same size functionality to adjust their sizes.
- Run the application. You should get following GUI:
- Change the device to Sun VGA using project properties | Platform | Device.
- Run the application again. Components shouldn't resize properly.
- Go back to design mode and modify all necessary components to resize.
- Run the application again. Components should resize properly now:
- Choose the OK button and add an event using right click | Events | Action | ActionPerformed.
- Use System.exit(0); as the code for this action.
- Run the application again. Show that once you click on OK the emulator gets closed.
Delete the demo project.