Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. public class FrameClose extends javax.swing.JFrame {
  2. public FrameClose() {
  3.  
  4. initComponents();
  5. }
  6.  
  7.  
  8. @SuppressWarnings("unchecked")
  9. // <editor-fold defaultstate="collapsed" desc="Generated Code">
  10. private void initComponents() {
  11.  
  12. setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
  13.  
  14. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  15. getContentPane().setLayout(layout);
  16. layout.setHorizontalGroup(
  17. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  18. .addGap(0, 400, Short.MAX_VALUE)
  19. );
  20. layout.setVerticalGroup(
  21. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  22. .addGap(0, 300, Short.MAX_VALUE)
  23. );
  24.  
  25. pack();
  26. }// </editor-fold>
  27.  
  28.  
  29. public static void main(String args[]) {
  30. /* Set the Nimbus look and feel */
  31. //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  32. /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  33. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  34. */
  35. try {
  36. for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  37. if ("Nimbus".equals(info.getName())) {
  38. javax.swing.UIManager.setLookAndFeel(info.getClassName());
  39. break;
  40. }
  41. }
  42. } catch (ClassNotFoundException ex) {
  43. java.util.logging.Logger.getLogger(FrameClose.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  44. } catch (InstantiationException ex) {
  45. java.util.logging.Logger.getLogger(FrameClose.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  46. } catch (IllegalAccessException ex) {
  47. java.util.logging.Logger.getLogger(FrameClose.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  48. } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  49. java.util.logging.Logger.getLogger(FrameClose.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  50. }
  51. //</editor-fold>
  52.  
  53. /* Create and display the form */
  54. java.awt.EventQueue.invokeLater(new Runnable() {
  55. public void run() {
  56. new FrameClose().setVisible(true);
  57. }
  58. });
  59. }
  60. // Variables declaration - do not modify
  61. // End of variables declaration
  62. }
  63.  
  64. JFrame frame = new JFrame();
  65. frame.dispose();
  66.  
  67. addWindowListener(new WindowListener() {
  68. @Override
  69. public void windowActivated(WindowEvent arg0) { }
  70. @Override
  71. public void windowClosed(WindowEvent arg0) { }
  72. @Override
  73. public void windowClosing(WindowEvent arg0) { }
  74. @Override
  75. public void windowDeactivated(WindowEvent arg0) { }
  76. @Override
  77. public void windowDeiconified(WindowEvent arg0) { }
  78. @Override
  79. public void windowIconified(WindowEvent arg0) { }
  80. @Override
  81. public void windowOpened(WindowEvent arg0) { }
  82. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement