I had used JDialog box to display an Error message ,
JOptionPane.showMessageDialog(
null, "ErrorMsg", "Failure", JOptionPane.ERROR_MESSAGE);
but the condition is the message box should always be on the foreground so that the user is bound to proceed and doesn’t misses it.
Hence i used a JFrame instead and used setAlwaysOnTop(true)
to display the message.i used JLabel and JButton and
I made it appear as JDialog by the help of the below link
How do I remove the maximize and minimize buttons from a JFrame?
I want to add a Error message symbol in the above frame as we get when we use JOptionPane.ERROR_MESSAGE type in a dialog.
I dont want to add an Image Icon in the JFrame.
I am extending my class from JDialog. Is it possible to use MessageType in my frame?
The Method
setAlwaysOnTop(boolean)belongs toWindowclass. So both classesJDialogandJFrameinherit this method. You can useJDialogmarked asAlwaysOnTop.You can use
JOptionPaneto prepare requiredJDialog: