tags:

views:

126

answers:

1

I am attempting to embedd webrenderer (a Swing based web browser) within a JDialog that has a default button defined. Hitting return in any of the form textareas within the loaded HTML is causing the JDialog default button to fire and close the dialog.

Due to the nature of the application I can't simply not use a default button on the dialog as it is a dynamically constructed generic dialog class used in multiple places.

I need some way to disable the default button handling/events ( I guess in much the same way that other JTextComponents must be doing). This is not helped by webrenderer being a 3rd party tool and I have no access to the source code.

Thanks Rob.

+2  A: 
jdialog.getRootPane().setDefaultButton(null);

reference: javax.swing.JRootPane::setDefaultButton(JButton)

Gunslinger47