BlackBerryForums.com : Your Number One BlackBerry Community      

»Sponsored Links




Reply
 
LinkBack Thread Tools
  (#1 (permalink)) Old
Mark Rejhon Offline
Retired BBF Moderator
 
Mark Rejhon's Avatar
 
Posts: 4,754
Join Date: Aug 2004
Location: Ottawa, Ontario, Canada
Model: 8310
Carrier: Rogers
Default How to paste 100% FORMATTED Source Code In Your Forum Posts - 10-14-2004, 10:26 PM

How To Attach Source Code To Your Forum Posts

PHP Code:
Attaching source code is done by copy-and-paste.  Howeveryou need 
to 
do a special procedure.  When pasting source code in your posts in the 
Developer Forum
dont forget to put a "[code]" at the beginning of your 
source code
, and then a "[/code]" at the end of your source code.   This 
prevents the forum system from messing up your source code


Example #1: Messy Paste

import javax.microedition.lcdui.*;

public class HelloWorld extends MIDlet implements CommandListener {
private Command exitCommand;
private TextBox tbox;

public HelloWorld() {
exitCommand = new Command("Exit", Command.EXIT, 1);
tbox = new TextBox("Hello world MIDlet", "Hello World!", 25, 0);
tbox.addCommand(exitCommand);
tbox.setCommandListener(this);
}

protected void startApp() {
Display.getDisplay(this).setCurrent(tbox);
}

protected void pauseApp() {}
protected void destroyApp(boolean bool) {}

public void commandAction(Command cmd, Displayable disp) {
if (cmd == exitCommand) {
destroyApp(false);
notifyDestroyed();
}
}
}



Example #2: Correctly Done Paste

PHP Code:
[code]

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class 
HelloWorld extends MIDlet implements CommandListener {
    private 
Command exitCommand;
    private 
TextBox tbox;

    public 
HelloWorld() {
        
exitCommand = new Command("Exit"Command.EXIT, 1);
        
tbox = new TextBox("Hello world MIDlet""Hello World!"250);
        
tbox.addCommand(exitCommand);
        
tbox.setCommandListener(this);
    }

    protected 
void startApp() {
        
Display.getDisplay(this).setCurrent(tbox);
    }

    protected 
void pauseApp() {}
    protected 
void destroyApp(boolean bool) {}

    public 
void commandAction(Command cmdDisplayable disp) {
        if (
cmd == exitCommand) {
            
destroyApp(false);
            
notifyDestroyed();
        }
    }
}
[/
code


Thanks,
Mark Rejhon

Questions? New BlackBerry User?

Last edited by Mark Rejhon : 03-15-2005 at 12:58 PM.
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
heybabylover Offline
New Member
 
Posts: 4
Join Date: May 2008
Model: 1
PIN: N/A
Carrier: 1
Wink Funny - 05-23-2008, 02:50 AM

hey, man. May i have a question? May i post a message to you?
   
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On






Copyright © 2004-2008 BlackBerryNews.com, BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.1