What is the difference between a JFrame and a JDialog?

Mahdi_Nine picture Mahdi_Nine · Apr 5, 2011 · Viewed 37.1k times · Source

What is the difference between a JFrame and a JDialog?

Why can't we use setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE); for a JDialog?

Answer

fortran picture fortran · Apr 5, 2011

JFrame is a normal window with its normal buttons (optionally) and decorations. JDialog on the other side does not have a maximize and minimize buttons and usually are created with JOptionPane static methods, and are better fit to make them modal (they block other components until they are closed).

But both inherit from Window, so they share much functionality.