import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import javax.swing.JDialog;import javax.swing.Jframe;import javax.swing.JLabel;import javax.swing.JPanel;public class Dlg extends JDialog { public Dlg(Jframe frame, String str) { super(frame, str); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { System.exit(0); } }); } public static void main(String[] args) { try { Dlg frame = new Dlg(new Jframe(), "No min max buttons"); JPanel panel = new JPanel(); panel.setSize(200, 200); JLabel lbl = new JLabel("blah blah"); panel.add(lbl); frame.add(panel); frame.setSize(400, 400); frame.setVisible(true); } catch (IllegalArgumentException e) { System.exit(0); } }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)