"Reprinted" Development of the j2's mobile app by netbeans-File Browser

Source: Internet
Author: User
Tags netbeans
ArticleDirectory
    • This is a very basic article. From the perspective of the official website, after I did it myself, I found that in this process, there are many places where the tutorials are not described in detail, write your own experiences, so that you can avoid detours.
    • Waiting Screen
This is a very basic article. From the perspective of the official website, after I did it myself, I found that in this process, there are many places where the tutorials are not described in detail, write your own experiences, so that you can avoid detours.

Pay special attention to the red font!

Before you begin, install the following software on your computer:

    • Netbeans ide 6.5 with the mobility package installed (download)
    • Java standard development kit (JDK) 6.0 (download ).

Body start:

Open netbeans ide6.5

Create a filebrowserexample Project
    1. Select "file" => "new project" (CTRL-shift-N ). In the "category" list, select the "Java me" option. In the "project" list, select "mobile application"Program"Option and click" Next.
    2. In the Project Name field, enterFilebrowserexample. Change "Project location" to any directory on your system.
    3. Deselect the "Create Hello MIDlet" check box. Click "Next.
    4. Retain the "Java me wireless toolkit" as the selected "Target Platform ". Click "Next.
    5. Click "finish.
      The project folder contains all source code and project metadata, such as the project ant script. The application itself is displayed in the streaming design window of the visual mobile designer.

Add the software package and visual MIDlet to the filebrowserexample project.
    1. In the project window, right-click and selectFilebrowserexampleProject,"New" = "" Java package"
    2. In the package name field, enterFilebrowserexample. Click "finish.
    3. In the project window, selectFilebrowserexampleThe Java package just created,"New" = "" visual MIDlet ..."
    4. In the "MIDlet name" and "MIDP class name" Fields, enterFilebrowserexample. Click "finish.
Add the component to filebrowserexample
    1. Switch the visual MIDlet to the "stream designer" window. Drag the following components in the component panel to the flow designer:

      • Enable screen
      • Text Box
      • File Browser
    2. Click Start Screen and change the value of the property text from null to file browser example in the Properties window.

    3. For example:

Figure 1

Add the command to filebrowserexample
    1. Open the stream designer window.
    2. Select the exit command option from the commands section of the component panel. Drag it to the filebrowser window.
    3. Select the "return" command from the "commands" Area of the "component panel" and drag it to the text box component.

Connect Components

In the stream design window, click Start Point on the mobile device and drag it to the spalshscreen component. Use the same method,

 
 

Connecting the components shown in Figure 1 is a problem here. How can I connect them ?! I have been exploring for a long time. It is very simple. In the component window, There is a component "previous screen operation"

 
 

 
 

 
 

Select it, drag it to the "started" command of "mobile device", and an arrow will be displayed, and then click splashscreen, and so on, you can connect to other components.

 
 

Insert the pre-operation into the source code
    1. Switch to the "Source" window.
    2. Insert the following at the end of the source code:Code. This method is used to read selected files:

      /*** Read File */private void readfile () {try {fileconnection textfile = filebrowser. getselectedfile (); gettextbox (). setstring (""); inputstream FCM = textfile. openinputstream (); byte [] B = new byte [1024]; int length = Fi. read (B, 0, 1024); FCM. close (); If (length> 0) {textbox. setstring (new string (B, 0, length) ;}} catch (ioexception ex) {ex. printstacktrace ();}}

    3. Find the commandaction method in the source code:Readfile ();
      InsertFilebrowser. select_file_commandIn the pre-operation section,I can't understand it. Don't worry, just add it here.:

    4. See the readfile ().

Run the project
    1. Press <F6> run main project or select "run"> "run main project ".

The effect is as follows;

Start debugging

Waiting Screen

 

Full text

 
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.