Paint using the interface user of BB

Hello. I am trying to create a simple application that draw things on the screen. If I do the drawing within the method paint (Graphics graphics) everything works fine, but if I try to do it in another way outside the paint, it won't work at all, the screen remains white. Here is the code:

public class blackberryApp extends UiApplication {    public static void main(String[] args) {        blackberryApp theApp = new blackberryApp();        theApp.enterEventDispatcher();    }

    public blackberryApp() {        //display a new screen        GameScreen Game = new GameScreen();        Game.start();        pushScreen(Game);    }}

public class GameScreen extends FullScreen implements Runnable {        public Graphics theGraphics;    public GameScreen() {        super();    }    public void start() {        theGraphics = getGraphics();        mainThread = new Thread(this);        mainThread.start();    }    public void paint(Graphics graphics) {    }    public void draw() {        if (theGraphics != null) {            theGraphics.pushRegion(new XYRect(0, 0, 240, 260));            theGraphics.setColor(Graphics.BLACK);            theGraphics.setColor(0x00FF00);            theGraphics.fillRect(50, 50, 30, 30);            theGraphics.setColor(Graphics.WHITE);            theGraphics.drawText("It works", 20, 20);            theGraphics.popContext();        }    }    public final void run() {        while (true) {            draw();            invalidate();            try {            Thread.sleep(100);            } catch (Exception e)            {            }        }    }}

The user of BB interface supports double-buffering, or I have to create an auxiliary buffer to draw inside first and then draw the buffer to the screen in the paint method? Maybe I should do "theGraphics = getGraphics()" somewhere else, like before I got a call to the draw() method?

Thank you for your response. I made the change for the blackberryApp class constructor and it works fine:

    public blackberryApp() {        //display a new screen        super();        GameScreen Game = new GameScreen();        pushScreen(Game);        Game.start();    }

But I have not used "invokeLater", I left the code as it was before, by calling the draw() method in the run() method of the thread and it works. I also added this.updateDisplay () after draw(). After reading the documentation of the API, I thought that invalidate() does the same thing as flushGraphics() in GameCanvas, but without doubt, I was wrong, because I removed it from the code and the design is still ok, can you tell me where it should be used? Thank you for your help.

Tags: BlackBerry Developers

Similar Questions

  • Model test using the interface user does not appear in the user interface

    I created a user interface for a model and trying to test it (using the model to test > start a new configuration > model UI (select user interface) > finish), it does not have the user interface, instead, it shows the summary of Configuration page. I checked the user interface, and there the correctly defined page flow. What is the reason for this and what is the solution. Thanks in advance.

    Check if you have associated page flow to the UI or not. Can be done in the edit page of the user interface.
    Check if you have added a page active in pageflow or not.
    Also make sure that you have visible page - page display of page condition is true.

  • Adding default and hidden metadata using the SDK user interface values

    Hello

    Is it possible to add a default value to a xmp_property, but using the SDK UI?

    Also is it possible using the SDK of the interface user of adding option to a document without him appearing on the opinion of the Committee?

    For example, I want to add a file, XMP "animal" with the value "cat" label by using the SDK of the user interface, but without the information displayed on the Panel.

    Thank you

    Trevor

    All the metadata in a file will be shown in the Raw, but this area will be added to the other point of view and change signs for anyone to be able to see or modify.

  • Lack of Snipping tool in the interface user of Windows 8 (NOT THE DESKTOP), but in any Windows Apps Store

    Is there any tool to capture in the user of Windows 8 interface?
    The only way I figured out was to use the PRINT SCREEN

    If none of these tools, it is a very big lack not being able to take just one part of a screen in the user of Windows 8 interface

    Windows 8 Pro (MSDN)

    I know where it is that I use daily and very often.  It does everything not in the user of Windows 8 interface
    On the desktop, there is no problem with him, but as soon as you go into the user interface of Windows 8 it is a similar tool when we are in the interface user of Windows 8 (Windows Store apps) so there's no way to use it?

    Hello

    Workaround for this would be to create a screenshot in the App Store, load the screenshot in Paint and and crop the image of what you want.

    There is a new keyboard shortcut in Windows 8 to create screenshots.

    1. press Windows + PRTSCN key. This will create a screenshot and automatically put my Pictures\Screenshots in your folder.

    2. open the screenshot in Paint and use the Select + tools to harvest.

    Concerning

  • Unable to connect to the interface user APIC

    Hello

    I erased the APIC servers configuration using "eraseconfig setup. I did this several times before and I've never had problems.

    Today, I followed the same process as before and rebuilt the cluster, but now I am unable to connect to the user interface. I get the following error of three servers:

    "REST datastore user authorization endpoint is not initialized - check fabric composition State of this node of tissue.

    Thank you

    Ben

    Ben,

    Access the console or the kvm to each controller APIC MMIC.

    Please try to connect to all the APICs 3 using the 'rescue-user' user name.  There should be no password because you have disabled the configuration...

    After scoring in each APIC, run and screen captures the output of the command 'acidiag avread'.

    Please reach the exits in your answer or check and verify the name of "tissue" on each APIC. They must match.  If not, you will need to "configuration eraseconfig" each APIC again and configure the APICs via the initial configuration script.

    Thank you

    T.

  • How can I close the Client Services for Netware that is me project to use the fast user switching without losing my internet connection

    For NetWeare customer service

    How can I close the Client Services for Netware that is me project to use the fast user switching without losing my internet connection

    Hello

    Your Windows XP question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in Forum.You IT Pro can follow the link for your question:

    http://social.technet.Microsoft.com/forums/en/category/w7itpro

  • You are able to use the CD of Windows Vista operating system on a laptop that has Windows 7 Home on it to use the Interface of Windows Vista?

    My situation is that I have a laptop that is a Windows 7 machine. I have a need where I'm considering purchasing a CD of Windows Vista operating system. It comes to be able to use the Interface of Windows Vista? I have a technical support of experience under my belt and I remember that if you need to have a different operating system available that you can use this operating system without installing it on your system.

    I really could use a version of Windows Vista now my educational purposes. My current computer has Windows 7 home running on it right now. Could you or someone give me Options to work with. I'll look forward to your response.

    Thank you

    Gary

    Q: "you are able to use the Windows Vista OS CD on a laptop that has Windows 7 Home above to use the Interface of Windows Vista?"

    A.  No.

  • Windows 7 requires using the "CHANGE USER" command to install Server Terminal Services (remote desktop) programs?

    It is necessary (or even possible) to use the CHANGE USER/install and CHANGE USER/execute commands to install a program in a Terminal Server (RDP) Services environment so that it is available to other users via RDP?

    Hello

    The question you posted would be better suited in the TechNet Forums. I would recommend posting your query in the TechNet Forums.

    http://social.technet.Microsoft.com/forums/en-us/winserverfiles/threads

    I hope this helps.

  • After changing the orainventory place im unable to connect using the oracle user

    Hello

    IM using oracle 12 c on rhel 6 after correctly installing the software, I changed the location of oravinventory in/data/houses

    / u01/app/Oracle

    After making these changes im is no longer able to connect using the oracle user...

    also I back return changes I had made to the orainventory folder still unable to connect using the oracle user...

    any help on this would be greatly appreciated

    Sadia. wrote:

    Hello

    IM using oracle 12 c on rhel 6 after correctly installing the software, I changed the location of oravinventory in/data/houses

    / u01/app/Oracle

    After making these changes im is no longer able to connect using the oracle user...

    also I back return changes I had made to the orainventory folder still unable to connect using the oracle user...

    any help on this would be greatly appreciated

    Newer versions of oracle have implemented a great new technology to help solve problems, called "error messages."  Unfortunately, I can't find any reference to an error message named 'is no longer able to connect.

    And why you are moving your site from inventory?  When you have installed oracle, he put the inventory where he wanted.  There is no reason to try to change or replace.

  • Change the language of the interface user InDesign CS6 (CC)?

    How can I change the language of the interface user InDesign CS6 (CC)? Currently, I have all the menus in Norwegian, but would like to have it in English. I remember all the options during installation to choose the language. I hope someone can help! Thank you very much!

    You have creative cloud then you can change the language of the application of the preferences of the MAO.

    Please find the link below for the article with the steps: -.

    http://helpx.Adobe.com/creative-cloud/KB/creative-cloud-trial-mode.html

    BTW no need to uninstall.

  • How to use the Weblogic user in my WebCenter application?

    Hello

    I'm doing my first Webcenter application. I have configured my wiki and weblogic server to connect, forum (discussions) with my users OID. So now any user OID can connect to this application.

    In my custom application Webcenter I configured JAAS security, now I would like to know how to use the same users OID in my application. Is this possible? Can someone help me? I tried Oracle Developers Guide, but it doesn't help me.

    Sorry for my bad English...

    Thank you

    Nelson

    You need to register a new provider of authentication on WLS. Please see this link http://www.oracle.com/technology/products/jdev/tips/fnimphius/oidconfig/index.html.

  • WIP 310 of configuration using the Web User Interface

    I just got my new WIP 310 - G2 phone and try to connect via my wireless router using the web interface of the phone.

    I don't see how I have the card information provided by my VoIP provider for different fields in the Web interface.

    I got information is of approximately

    • Name of user and password (phone number)?
    • Proxy IP and Port requested
    • Outgoing Port and Proxy number
    • Expire time
    • Time to package
    • DTMF relay
    • UDP Port number
    • RTP Port number

    Hope that somepone could help me with some links to documentation and advice on how to do it.

    See this link to configure WIP 310.

  • Use the Flex user interface in a PS plugin

    Hello!

    I am a user relatively to the Flex user interface design! A couple of days, I thought to give my PS plugins a look of the Flex user interface! I searched the internet on some tutorials or guides, but there is very little information relating to this. The guide Builder Extension CS says that we can interact with the Flex user interface & a native application by using the branchezBranchez C++ library. There is an example of code in Illustrator SDK for the same under the name FreeGrid (C++) & FreeGridUI(Flex UI). But I couldn't find an equivalent in PS.

    On further research in this regard, I found that we can use the PlugPlug.h (& .cpp) with a few changes in our C++ PS of the plugin code. I'm stuck at this stage now. How can I do to get out of here?

    Guide me people.. !!

    Thank you!

    This would be the part "all the settings you will need to do to get them working in the context of Photoshop" of my post! :-)

  • How to use the same user interface project for different HumanTask in GR 11, 1 material BPM

    When I set a user interaction activity in my process of material Oracle BPM 11 GR 1 and associate a human task with it. It generates a new project to contain all my forms. Anyone know if it is possible to use the same project for the different human task?

    After generating the UI for your first human task project, you can click with the right button on the project in JDeveloper and select 'New', click on the tab "Technologies all", then "JSF'-> ' ADF task based on human task workflow of." Then find the file your BPMN/composite project .task.

  • After a time when the data added to the interface user blocked - WPF

    I am currently using WPF graphics.

    I have created a simulation that describes the problem that I have experienced in my application (attached).

    I have two sons, we generate data (in my application gets the material data every second) and the other copies the data in the user interface (copy the data to a variable, which bind to the data source).

    Every second I get 1000 points and adds them to the data. The first seconds it works well, after a while it gets stuck.

    I added a listbox control that displays the time, need to add the variable data and gradually increases.

    I have two questions:
    (1) did whenever I have add data, it attracts all the existing data again? If so, theres a way to improve or prevent this behavior?
    (2) how many points can represent the graph at a glance? (which is the limit of the graph)?

    Thank you

    HODAYA Shalom.

    Your example updated debugging, I think that the question is the Dispatcher.Invoke calls that you use to communicate with the user interface thread. Since you use the delegate only, all calls are sent with Normal priority, which means that events of low priority (as made graphic, or updated on day of data binding to scales) can get transformed. Using a lower as priority Render four Invoke calls not glued to the UI in my tests.

Maybe you are looking for

  • HP Netbook help and Support - search for the drivers, etc..

    I do not understand what to do at this point... I'm trying to make sure that all the drivers are ok and updated in the hope that my continuous horrible problems in Windows Media Player may one day be solved. If my drivers are up to date, back to the

  • Speakers not connected after Windows update

    Windows 7 update will be "unplugging" are then 'reconnect' after I did the updates.  I looked through the other questions on this and have not found a solution.  It is linked to updates and doesn't happen then.  Last updated "unplugged" and has not o

  • FULL ROUTING DNS DOMAIN NAME

    Hello world I have an FQDN object on our firewall, IP address of this Exchange every day so the firewall has a rule to allow access to it on a specified port number. Example: allowed to Access-list inside_access_in line 284 extended tcp host 192.168.

  • Oracle 11g (11.2.0.1.0) client installed on Windows server standard edition 2012 - question

    HelloWhen I tried to install oracle client (Oracle 11 g (11.2.0.1.0)) client installed on Windows server 2012 standard edition got following error."ins-13001 environment does not meet the minimum requirements. 64 bit Windows 2012"So, I have two conce

  • Why my background image isn't appearing?

    I want to have a background image for my central section. so I made the background of this image in my css. but the image will not be displayed. what I am doing wrong? Thank youhttp://www.mamacinis.com/