• Post Reply Bookmark Topic Watch Topic
  • New Topic

defautl button?  RSS feed

 
three tires
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi:
I have used JInternalFrame.getRootPane().setDefaultButton(okBt) ,
but the okBt never work ?
How to set default button to JInternalFrame .
 
Prashant Sehgal
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing a similar problem...
Have you found a solution to this yet?
 
three tires
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have not , and U ?
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had to do some research on this one. I think this line from the JRootPane api setDefaultButton method
"For default activation to work, the button must be an enabled descendent of the root pane when activation occurs."
points toward the trouble. The internal frames button is not (enough a) part of the root pane of the JFrame.

Here's something that seems to work:
 
three tires
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
done, Thank U!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!