• Post Reply Bookmark Topic Watch Topic
  • New Topic

Focus on JTextfield in Applet problem  RSS feed

Eric Chang
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was wondering if anyone has experienced this problem when dealing with focusing on Swing components in an Applet. I have an Applet with various panels, etc. and I would like the focus to default to the first field in one of the panels after it is rendered. However, this particular panel will change based on User inputs, so it gets refreshed quite a bit. The problem I'm experiencing is that my requestFocus() call does not 100% reliably get executed AFTER the panel is redrawn...so sometimes the focus does not work. I've attempted to use the SwingUtilities.invokeLater method to try to get it to work, and it works great in an AppletViewer, but not while the applet is in the browser (Mozilla 1.6.1), and I've used Swing's Timer class to try it too, and that works maybe 75% of the time. I'm using Java 1.4 and unfortunately, I can't change that or the browser I'm working with.
Any tips or solutions would be greatly appreciated! Thanks.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!