Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-29-2008, 12:58 AM
Member
 
Join Date: Mar 2008
Posts: 1
Snalk is on a distinguished road
Calling displayable from a canvas class
Hello, i am having trouble calling the displayable-funcion
in my MIDlet class from a separate class.

I want to trigger either testForm1 or testForm2 (whichever is most easy)
and put it as the current displayable in my MIDlet when pressing LEFT
without using canvas as a subclass in my SchemaMidlet.
How ?

This is a oversimplification of my programs structure:

Code:
class mainCanvas extends Canvas { Form testForm1; .... public mainCanvas { testForm1 = new Form("Hello1"); .... public void paint(Graphics g) { .... } protected void keyPressed(int keyCode) { if (getGameAction(keyCode) == Canvas.LEFT) { ***HERE I WANT TO CHANGE THE CURRENT DISPLAYABLE*** this.repaint(); } } } public class SchemaMidlet extends MIDlet implements CommandListener { private mainCanvas schemaCanvas; public Display display; Form testForm2; public SchemaMidlet() { schemaCanvas = new mainCanvas(); testForm2 = new Form("Hello2"); } protected void startApp() { display = Display.getDisplay(this); schemaCanvas.setCommandListener(this); display.setCurrent(schemaCanvas); schemaCanvas.repaint(); } public void commandAction(Command c, Displayable s) { ... } protected void destroyApp(boolean unconditional) { } protected void pauseApp() { } }
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling a method in another class uncopywritable New To Java 8 01-14-2008 05:37 PM
Calling method from another class asahli New To Java 1 12-15-2007 07:24 PM
Problem calling another class adlb1300 New To Java 3 10-25-2007 03:05 PM
calling a java class from html Ed Advanced Java 1 07-08-2007 01:58 AM


All times are GMT +3. The time now is 02:38 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org