473,548 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[Help Please] Graphics programming problem.

Ok, I've spent nearly a week trying to sort what should be an easy
task to accomplish but I'm totally flumoxed!

I want to do something pretty simple...
1. display image1

2. wait until image1 is drawn to the screen

3. wait 0.25 seconds
4. display image2

5. wait until image2 is drawn to the screen

6. wait 0.25 seconds
7. display image3

8. wait until image3 is drawn to the screen

9. ...
I've been using Java for about a year now (self taught) but this is
the first time I have tried to do anything with graphics. The above
sequence is to simulate a dice rolling. What happens is that Java
appears to jump straight to #8. From reading books and posts etc, I'm
guessing that #1, #4 and #8 are being done but the screen repaint is
only being done after #8.

***
So, the simple question is:
How do I force Java to wait until the screen has been updated before
doing another graphics op.
***

A friend found the following in a book:

public synchronized void repaintAndWait( ) {
repaint();
try {
wait();
}
catch (InterruptedExc eption ex) { }
}

public synchronized void paint(Graphics g) {
// do painting here
...
// notify that we're done painting
notifyAll();
}
However, on trying this, the compiler gives me an error:

PokerDice.java [682:1] cannot resolve symbol
symbol : method repaint ()
location: class gameDice
repaint();
^
1 error
Errors compiling PokerDice.
I don't understand the error because I use "repaint(); " in several
places without error but it doesn't seem to like that particular
instance.

I'd be very greatful to anybody that can help me out with this. As I'm
self taught when it comes to Java, (I'm a Pascal & VB programmer by
nature!) I'm keenly aware that there are great gaps in my knowledge.
However, I'm amazed that something that should be so simple is proving
to be so difficult.

Cheers,

Pudi.

BTW I'm using the NetBeans IDE.
Jul 17 '05 #1
0 1597

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1161
by: Saadi | last post by:
Hey Guys! I am Saadi, and working on C language for some small and simple projects for a long time. But now I have start working with C Graphics, and want to create a small scale Operating System. Can any body help me on this topic or recommend me some nice and juicy books that help me. It is new topic for me and I want to learn it from...
9
2397
by: Steve Long | last post by:
Hello, (total GDI newbie) I'm having trouble drawing just a simple line to display in a picturebox. I just want a straight, dotdash line. I have two methods, one works and one doesn't (it cause an exception to be thrown): This one works but it's not the results I want. private void CreateImage1() {
2
2146
by: c++ newbie | last post by:
I am new to c++ programming I have Borland Turbo c++ ver 3.0 I copied the installed Tcc files from my friends hdd in a cd and pasted it directly into my hdd at d:\lang\tcc\ when i open tc++ it tells invalid directory. Nothing works even the sample files in that folder also does not run. I am sure the codings are perfect because they work in...
2
1689
by: juvi | last post by:
Dim myGraphics As System.Drawing.Graphics Dim buffer As Bitmap Dim fr_bm As Bitmap Dim to_bm As Bitmap Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick pbxclock.Refresh() pbxclock.Image.Dispose()
6
1562
by: André | last post by:
Hi, I made a webform for a survey, with multiple-choice questions. The results of each question is put into a table e.g.: values frequency 1 6 2 3 3 32 4 26 5 12
12
3572
by: Xah Lee | last post by:
Of Interest: Introduction to 3D Graphics Programing http://xahlee.org/3d/index.html Currently, this introduction introduces you to the graphics format of Mathematica, and two Java Applet utilities that allows you to view them with live rotation in a web browser. Also, it includes a introductory tutorial to POV-Ray.
1
2278
by: glenn123 | last post by:
Hi, i am just about out of time to produce a working jukebox which has to perform these functions: to play music files when a track is chosen from a list which when the user presses the change genre button the list is populated with a list of that genre. I have got the interface done to satisfaction, my problem is that when i press the change...
0
5536
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
2
2124
by: zakaria2710 | last post by:
Would u help me with this task, I am new in C++ programming, this codes have alot of errors, I have never work with graphs before, I am using Borlard C++ Ver 5.02. I was told u can not run a graph task using text editor. If that is the case how can I run this. I have only 7Days to handin this Task. (a) Explain what process are being carried out...
0
7438
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7707
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7951
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7803
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5082
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3475
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1926
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
751
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.