You Are Here:

Community: Developer Discussion Boards

#1 Old Emulators and graphic bug ? - 2004-05-30, 23:15

Join Date: May 2004
Posts: 2
folky
Offline
Registered User
Hi,
I'm building a midlet with Series 60 MIDP Concept SDK Beta 0.3.1 and borland JBuilderX and I'm having a problem with the paint() – repaint() – method.

Sometimes I can’t get the screen refreshed when a call repaint().
This only append when the paint() method need to block in a semaphore or need to wait for some data in a DataInputStream (via Bluetooth). The weird thing is that while the application is still blocked, if I minimize and then maximize the emulator’s windows (in windows XP), the emulator’s screen gets refreshed (while still blocking and waiting for data). This makes me believe that it may be a bug with the emulator.
If I don’t minimize/maximize, the screen only is repaint once the data get received via the Bluetooth DataImputStream.

Here is some interesting parts of my paint() method, it may help to understand what is happening

public void paint(Graphics g) {
g.setColor(WHITE);
g.fillRect(0, 0, Width, Height);
g.drawImagemar,boardLeft,boardTop,Graphics.LEFT|Graphics.TOP);.
g.setColor(BLACK);
for (int i = 0; i < 7; i++) {
g.fillRect(boardLeft, boardCellSize * i + boardTop, (boardCellSize * 6) + 2, 2);
g.fillRect(boardCellSize * i + boardLeft, boardTop, 2, boardCellSize * 6);
}

if (!Plays)
g.drawString("wait for your opponent’s move...", boardLeft, boardTop + boardSize + 5, (Graphics.TOP | Graphics.LEFT));
else
g.drawString("It’s your turn...", boardLeft, boardTop + boardSize + 5, (Graphics.TOP | Graphics.LEFT));

if (!Plays) { //here it blocks until it receive the data via bluetooth
try {
Pos = in.readInt();
Damage = in.readBoolean();
Loose = in.readBoolean();
Plays = true;
}
catch (Exception e) {}
}
}

So when Plays = true, the screen gets refreshed with no problem, but when Plays = false, the problem occurs (even if I use serviceRepaints() after the call of repaint()).

Well I would like to know if this has already appended to someone or if I’m doing something wrong. Well, what to you think about that and the strange thing about minimize / maximize ?
Also note that this problem also occurs with other IDE and that the class extends from Canvas.
Last edited by folky : 2004-05-30 at 23:17.
Reply With Quote

#2 Old 2004-05-31, 00:53

Join Date: May 2004
Posts: 2
folky
Offline
Registered User
I've resolved the problem puting all the bluetooth communication code in a thread, like that the paint method does not block anymore.

Anyway, the behavior of the paint method seems very strange to me and I can't explain the minimize/maximize...
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ