This is an old revision of the document!
JDialog
dlgAbout extends javax.swing.JDialog { /** * Creates new form dlgAbout */ public dlgAbout(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); } private void btnOKActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.setVisible(false); // close current window } }
In other window or menu, call dialog to open it:
package com.acme.showcase; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ public class frmMain extends javax.swing.JFrame { public frmMain() { initComponents(); } //... private void mnuAboutActionPerformed(java.awt.event.ActionEvent evt) { dlgAbout dlg = new dlgAbout(this, true); dlg.setVisible(true); } }