Results 1 to 14 of 14

Thread: Dialog Image

  1. #1
    Join Date
    Dec 2008
    Location
    Manchester England
    Posts
    14
    Rep Power
    0

    Default Dialog Image

    I have wrote a periodic table app that displays the periodic table. If you click on the appropriate box the app loads up a modal dialog box for that particular element. The dialog contains information and an image. 99% of the time the dialog box loads up ok. Occasionaly the dialog frame will load but nothing is displayed. If i move the Dialog behind another window or the edges of the screen the picture appears, its as if the window is locked up and needs repainting. Any ideas about whats going on?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You've got a bug in your code?

  3. #3
    Join Date
    Dec 2008
    Location
    Manchester England
    Posts
    14
    Rep Power
    0

    Default

    Im not so sure about having a bug in my code. The program does not lock up. When you close the dialog and then reopen the dialog it works fine. Only occasionaly does the dialog not show the image and the data. I am only asking here in case more experienced java users have come across this problem or similar problems. I have checked and rechecked my classes, search java resources on the net, all to no avail. If "You've got a bug in your code?" is the best you can come up with, then this place is off no help also.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by crystalClear View Post
    If "You've got a bug in your code?" is the best you can come up with, then this place is off no help also.
    My answer was appropriate to the amount of information given. You can have intermittent bugs due to errors in your code especially if you run afoul of Swing thread safety in any portion of the code or for a host of other reasons, but it's impossible to tell based on what you've told us and without seeing code.
    Last edited by Fubarable; 02-24-2009 at 08:58 PM.

  5. #5
    paul pasciak is offline Senior Member
    Join Date
    Jul 2008
    Posts
    125
    Rep Power
    0

    Default

    I can kind of recall experiencing a
    problem like this long ago.

    So I've tried to simulate your
    problem in a dialog of one of my
    recent projects.

    I couldn't.

    I think your problem is not in the
    dialog. It seems like code elsewhere
    my be pre-empting the dialog update.

    The only other idea I can think of
    is that you have a very outdated
    version of Java.
    (I hate making that suggestion.)

  6. #6
    Join Date
    Dec 2008
    Location
    Manchester England
    Posts
    14
    Rep Power
    0

    Default

    Thanks for the prompt responses lads and/or ladies. I will go over my app 1 more time, if i get no joy i will post the relevent code snippits.

  7. #7
    Join Date
    Dec 2008
    Location
    Manchester England
    Posts
    14
    Rep Power
    0

    Default

    Cheers Fubarable "especially if you run foul of swings thread safety". This made me think, I was testing my app in bluej, which must be running its own threads. I suspect the app was getting tangled in bluej threads so to speak. I created a jar file, ran the program and cannot reproduce the error, everything works fine. As i say im new to Java and grateful for any help.
    Good day to all.

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default

    > I suspect the app was getting tangled in bluej threads so to speak.
    That's just... silly.

    It's far more likely that your way of loading and/or displaying the image is incorrect.

    db

  9. #9
    Join Date
    Dec 2008
    Location
    Manchester England
    Posts
    14
    Rep Power
    0

    Default

    Darryl.Burke says "I suspect the app was getting tangled in bluej threads so to speak.
    That's just... silly.". Well explain why the executeable byte code version does not have any errors. It works perfectly. but in the blueJ enviroment it produces the error eluded to in the above discussion. Im suprised at a senior member coming out with illogical tripe like that Darryl.Burke. Another thing i find on some forums and this place looks no different is people butting in when they have nothing constructive to say. As if they are some kind of Guru.

  10. #10
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    I would listen and take to heart to what Darryl says here. He knows more about image display in Swing components than you or I will ever know.

  11. #11
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default

    From the Swing concurrency tutorial* (emphasis added)

    Programs that ignore this rule may function correctly most of the time, but are subject to unpredictable errors that are difficult to reproduce.

    * The Event Dispatch Thread (The Java™ Tutorials > Creating a GUI with JFC/Swing > Concurrency in Swing)

    Since you haven't shown any code, there's no point in anyone here trying to guess what you might have done wrong. If you want to get help, post a SSCCE** that demonstrates the problem. (It doesn't matter if it shows that problem in your IDE and not when run outside of the IDE.)

    ** SSCCE : Java Glossary

    db
    Last edited by DarrylBurke; 02-25-2009 at 06:28 AM.

  12. #12
    Join Date
    Dec 2008
    Location
    Manchester England
    Posts
    14
    Rep Power
    0

    Default

    Your just ganging up now like school yard bullies. Explain why the executable works perfectly but does not work properly in the bluej enviroment. It may not be threads, but it is something in the Bluej enviroment causing the problem, simple as, compendo. The problem is fixed, no more help is needed, the images display perfectly, the application is a masterpiece, get the picture. I have looked around at some post and this place looks a bad place to do business. It has brain dead senior members, image graphic expert with no common sense, need i say more. Good bye All and good ridence.

  13. #13
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default

    All I can say is, I sincerely pity the developers who wlil one day work with you in the same team.

    And there'll be a lot of them, because nobody'll want to keep you long.

    I'm reporting your post to the moderators for being confrontational and inflammatory. Nobody was rude to you here, but you chose to resort to personal attacks to cover up your unwillingness to learn to do things the corect way.

    db

  14. #14
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Good bye All and good ridence.
    You're right: No need to say more.

Similar Threads

  1. Replies: 14
    Last Post: 04-10-2009, 08:46 AM
  2. Canvas Image popups another image (SWT)
    By SpaceY in forum New To Java
    Replies: 2
    Last Post: 11-11-2008, 01:25 PM
  3. drawing an image to an offscreen image
    By hunterbdb in forum Java 2D
    Replies: 9
    Last Post: 10-30-2008, 06:17 PM
  4. Dialog
    By JavaLerner in forum AWT / Swing
    Replies: 27
    Last Post: 07-07-2008, 11:29 AM
  5. Replies: 0
    Last Post: 01-08-2008, 05:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •