Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Repainting in supplementary frame

 
Eric Barnhill
Rancher
Posts: 233
Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I'm writing an applet that first takes a username and password before starting. It's in CardLayout and this is the first card; after the password is validated the card "flips" to the program proper. Now, if you type in a name that's registered, a dialog pops up that says something to the effect of "we don't have that name, would you like to register a new account?" If you click okay the dialog closes and a new frame pops up with three labels and three textfields, to get your new username, new password, and to verify the password.
This last frame only repaints when I adjust the window or switch to another program and back. It doesn't even show a blinking cursor if you focus on a text field, let alone what you type in it. But if I then pull on the window, it shows me what I just typed, so the frame is taking data. This is in contrast to the initial card, which doesn't have anything fancy but shows a blinking cursor and whatever was typed in the fields immediately, like normal.
How can I get this supplementary frame to stay "active"? Is this a thread thing ? Or, do I need to add key listeners and focus listeners and put repaint() in them, so each time a field is used or selected, it shows up right away? I tried something similar but couldn't get it to work. If this is unclear I'd be happy to elaborate. This is probably a very basic thing but I am definitely stuck. I'm using Swing GUI, should that matter in this instance.
Regards,
Eric Barnhill
 
Norman Solomon
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had the same problem and solved it as follows (after may hours research)
Pass a copy of the parent to the frame as a frame constructor parameter. Then you can call the parents paint() method from within the frame
e.g. parent.repaint();
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!