• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dialogbox getting stuck on paint  RSS feed

 
Ole-Johan Jakobsen
Greenhorn
Posts: 3
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings.

I have a small problem with a dialogbox and a paint method I hope someone can help me with. I couldn't find any exsisting threadds on this matter, but if there is please direct me to it so I can close this one.

I've made a menu to host some mini-games and on the menu I've made it possible for the user to change his/her username by pressing a button to make a Dialogbox appear to let them write a new name.
After they've made a new name and pressed "ok", the menu is repainted with the new name on it. This works wonderfully, except for a few occasions where a picture of the dialogbox is stuck on
the menu itself.

Like this:

http://img148.imageshack.us/g/promptk.png/

The box anomaly is easily removed by clicking anywhere in the window,which calls repaint(), but it still looks ugly when it happends. I've tried putting repaint() and revalidate() after the dialogbox is closed, but the problem prevails.

Anyone have any idea what could be causing this?

Thanks in advance.
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would help quite a bit if you were to tell us what technology you're using. And perhaps some of the relevant code.

rc
 
Campbell Ritchie
Sheriff
Posts: 53779
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
I think this thread would sit better on our GUIs forum, so I shall move it.
 
Ole-Johan Jakobsen
Greenhorn
Posts: 3
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Ritchie.

Ralph Cook wrote:It would help quite a bit if you were to tell us what technology you're using. And perhaps some of the relevant code.

rc


Sure, I'm coding Java in Eclipse IDE.

The method for taking taking care of the user input is here:


The username is drawn in paint after the dialog box closes.


 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something tells me this problem isn't going to get solved without a SSCCE <--- link
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think it's going to be solved until we at least find out what UI technology is being used. This has been moved to the forum for "Swing/AWT/SWT/JFace", hopefully it's one of those.

rc
 
Rob Spoor
Sheriff
Posts: 20898
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You override paint(Graphics) but only call super.paintComponent(g). paint(Graphics) does so much more. Override paintComponent(Graphics) instead (and keep it protected).
 
Ole-Johan Jakobsen
Greenhorn
Posts: 3
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:Something tells me this problem isn't going to get solved without a SSCCE <--- link


Will keep that in mind, thanks for the link.

Rob Spoor wrote: You override paint(Graphics) but only call super.paintComponent(g). paint(Graphics) does so much more. Override paintComponent(Graphics) instead (and keep it protected).


I will give this a shot, thank you.

Ralph Coook wrote:I don't think it's going to be solved until we at least find out what UI technology is being used. This has been moved to the forum for "Swing/AWT/SWT/JFace", hopefully it's one of those.


Ah, of course I forgot to mention.

I use AWT for the Graphics, Font, Color and BufferedImage. Swing for the Panel and Dialogbox.

 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!