import java.awt.*; import oracle.jdeveloper.layout.*; import java.awt.event.*; public class EDialog extends Dialog { public EDialog(Frame parent, String title, boolean modal) { super(parent, title, modal); enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); add(panel1); pack(); } catch (Exception e) { e.printStackTrace(); } } public EDialog(Frame parent, String title, boolean modal,String msg) { super(parent, title, modal); enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { EDialog =msg; jbInit(); add(panel1); pack(); } catch (Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { this.setTitle("Error Dialog Box"); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // Dimension frameSize =frame.getSize(); // frame.setLocation((screenSize.width - frameSize.width)/4, (screenSize.height - frameSize.height)/4); panel1.setLayout(xYLayout1); panel1.setBackground(SystemColor.control); Ok.setLabel("Ok"); Ok.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { Ok_actionPerformed(e); } }); l_Error.setText(" "+EDialog+" "+"Field Cannot be null"); panel1.add(l_Error, new XYConstraints(19, 14, 348, 23)); panel1.add(Ok, new XYConstraints(145, 96, 76, 29)); } FlowLayout flowLayout1 = new FlowLayout(); Panel panel1 = new Panel(); XYLayout xYLayout1 = new XYLayout(); Label l_Error = new Label(); Button Ok = new Button(); String EDialog; public EDialog(Frame parent) { this(parent, "", false); } public EDialog(Frame parent, boolean modal) { this(parent, "", modal); } public EDialog(Frame parent, String title) { this(parent, title, false); } protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_CLOSING) { cancel(); } super.processWindowEvent(e); } void cancel() { dispose(); } void Ok_actionPerformed(ActionEvent e) { System.out.println("In Ok_actionPerformed"); dispose(); } }