FeaturesPluginsDocs & SupportCommunityPartners

NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Accessing GameDesign in Midlet Flow

 
Post new topic   Reply to topic    NetBeans Forums -> Java ME Users
View previous topic :: View next topic  
Author Message
dpeak



Joined: 17 Mar 2009
Posts: 1

PostPosted: Tue Mar 17, 2009 12:59 pm    Post subject: Accessing GameDesign in Midlet Flow Reply with quote

Hello,

I am new with JavaME in Netbeans. I want to create a game for my mobile but got stuck when it came to switching from the menu to the game itself.

The menu is a midlet called MyMidlet and the GameDesign is a seperate class:



Can anybody tell me how to program a command to run the game in the GameDesign class?

I heard that it is possible to add a whole class to the Pallete to add it from there to the Flow but I couldn't figure out how.

Please help.
Back to top
View user's profile Send private message
kherink



Joined: 19 Mar 2009
Posts: 1
Location: sydney, aus

PostPosted: Thu Mar 19, 2009 11:32 am    Post subject: source code solution Reply with quote

I would create a List in the flow, then add a List Element to it (call it "Start game") then in the Source view i would modify the listAction() method to look something like this:

Code:
    //<editor-fold defaultstate="collapsed" desc=" Generated Method: listAction ">
    /**
     * Performs an action assigned to the selected list element in the list component.
     */
    public void listAction() {
        // enter pre-action user code here
        String __selectedString = getList().getString(getList().getSelectedIndex());
        if (__selectedString != null) {
            if (__selectedString.equals("Start game")) {
                // write pre-action user code here
 
                // write post-action user code here
                this.gameCanvas = new DemoGameCanvas();
                this.t = new Thread(gameCanvas);
                t.start();
                Display d = getDisplay();
                d.setCurrent(gameCanvas);       
            }
        }
        // enter post-action user code here
    }
    //</editor-fold>


this will not show up as anything meaningful in the flow view but should do the trick of starting up the game design
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java ME Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB