Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (683)
Games in Android Showcase (196)
games submitted by our members
Games in WIP (751)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Swing Applet - Sometimes doesnt display..  (Read 1502 times)
0 Members and 1 Guest are viewing this topic.
Offline steveyO
« Posted 2009-07-27 22:24:39 »

Am really struggling with an issue.. Any pointers appreciated.

I have some Multiplayer Java Swing Applets on my new site.  Approximately once every 10 times, the main panel doesnt display (just a completely white applet)..  I have debugged and there seems to be no difference in the panel creations between the working and non-working version (well of course apart from it being displayed)...  Have upgraded to latest Java version and still doesnt fix..  + interestingly on my laptop when using Firefox, clicking on the applet when it doesnt display fixes it.. And in Internet Explorer moving the browser scroll bar also fixes the problem (but on my desktop with same version of FF clicking doesnt fix, ie.  applets is still blank)... When running from eclipse it fails to display less often (approx 1 in 25).  Removing the loading of images doesnt fix either..

Am at a bit of loss what to try next.. Anyone experience anything similar? Annoying Little Gits (Android)   Play java (applet) games! Free Online Chess Clock
Offline markmistry

Junior Devvie

« Reply #1 - Posted 2009-07-28 01:24:36 »

yeah my sis was havin same problem on her laptop dont know what os or browser.. she was in my game next she said it had white screened,never happened to me all the 500 million times i have tested it?Huh very strange. could have been the reason why she wasnt speaking to me in my
my swing box starts when my game starts in an applet.would be nice to know what causes it.
Offline steveyO
« Reply #2 - Posted 2009-07-28 19:03:57 »

ok will let u know if ever find the problem.. Just spent another hour with no luck..
Have had similar problem in past and found that using a MediaTracker for loading images solved.. but this isnt the case for me.. Its bloody annoying. Annoying Little Gits (Android)   Play java (applet) games! Free Online Chess Clock
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline erikd

JGO Ninja

Medals: 16
Projects: 4
Exp: 14 years


« Reply #3 - Posted 2009-07-28 21:35:50 »

My first thought is that you might be doing something on another thread than the AWT event dispatch thread where you should, but it's difficult to tell for sure without seeing some code.
Maybe you should try to come up with a small test case and post the code here.

Offline Wildern

Junior Devvie

« Reply #4 - Posted 2009-07-29 15:57:52 »

It sounds like you might be using paint/repaint to control your game loop and are relying on an external trigger to cause the first paint.
But I am just guessing... can't really do more than that without seeing some code  Undecided
Offline steveyO
« Reply #5 - Posted 2009-07-29 19:46:22 »

Thanks for the suggestions.. Unfortunately cant post any code as there are loads of classes involved (using an open source API).  My guess at the moment is its thread related (hence why am struggling, will look t the AWT event dispatch stuff.. not too familiar)..  Have tried some stupid fudges like calling my panel repaint 5000 times after it is initialized and this significantly reduces the blank applet occurences but doesnt fix.. Its annoying,,can sometimes refresh my browser 50 times without seeing it and then it happens 3 or 4 times in quick succession.  Would much rather be coding new games than debugging but has to be done.. Urgh. Annoying Little Gits (Android)   Play java (applet) games! Free Online Chess Clock
Offline Wildern

Junior Devvie

« Reply #6 - Posted 2009-07-30 03:32:42 »

If calling repaint helps, perhaps you need an update method...  and all of your offscreen image creation/loading should happen in addNotify()

public class Foo extends Applet implements Runnable {
   public void update(Graphics g) {
   public void addNotify() {
Offline steveyO
« Reply #7 - Posted 2009-07-31 19:57:15 »

Thanks for suggestion Wildern... The below didnt quite work for me as part of the applet components are  partially declared in init() and  then when a connection to the server is established ..
Luckily 'Touch Wood' it looks like I have fudged it.. I am calling panel.repaint() and panel.revalidate() 1000 times before and after adding the main panel and it seems to fix 'i.e. fudge fix' it... Phew!!  Dont really know why but tbh.. dont really care  Smiley Annoying Little Gits (Android)   Play java (applet) games! Free Online Chess Clock
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

orrenravid (225 views)
2016-07-16 03:57:23

theagentd (294 views)
2016-07-11 14:28:54

Hydroque (382 views)
2016-07-06 05:56:57

Hydroque (533 views)
2016-07-03 08:52:54

GrandCastle (403 views)
2016-07-01 09:13:47

GrandCastle (396 views)
2016-07-01 09:09:45

CopyableCougar4 (449 views)
2016-06-25 16:56:52

Hydroque (422 views)
2016-06-22 02:17:53

SwampChicken (387 views)
2016-06-20 13:22:57

SwampChicken (306 views)
2016-06-20 13:22:49
Making a Dynamic Plugin System
by Hydroque
2016-06-25 00:13:25

Java Data structures
by BinaryMonkL
2016-06-13 21:22:09

Java Data structures
by BinaryMonkL
2016-06-13 21:20:42

FPS Camera Tutorial
by Hydroque
2016-05-22 05:40:58

Website offering 3D Models specifically for games for free
by vusman
2016-05-18 17:23:09

Website offering 3D Models specifically for games for free
by vusman
2016-05-09 08:50:56

Website offering 3D Models specifically for games for free
by vusman
2016-05-06 11:10:21

Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!