Results 1 to 3 of 3
  1. #1
    arunkumarinfo is offline Member
    Join Date
    Jan 2009
    Posts
    15
    Rep Power
    0

    Thumbs down i cant dispose the jframe(urgent)

    Java Code:
    import java.lang.Thread;
    public class exiting extends javax.swing.JFrame
     {
        Thread runner;
        int num = 0;
       public exiting()
       {
          initComponents();
    	  setLocationRelativeTo(null);
    	  iterate();
        }
        private void initComponents() 
    	{
            jProgressBar1 = new javax.swing.JProgressBar();
    		jProgressBar1.setStringPainted(true);
            jLabel1 = new javax.swing.JLabel();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Closing");
            setLocationByPlatform(true);
            setResizable(false);
            jProgressBar1.setBackground(new java.awt.Color(255, 255, 255));
            jProgressBar1.setForeground(new java.awt.Color(142, 206, 227));
            jProgressBar1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
            jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
            jLabel1.setForeground(new java.awt.Color(0, 0, 255));
            jLabel1.setText("Have ANice Day");
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(19, 19, 19)
                            .addComponent(jLabel1))
                        .addGroup(layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(25, Short.MAX_VALUE))
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(24, 24, 24))
            );
         pack();
        }   
        public void iterate()
        {
    	while (num < 150){
          ProgressBar1.setValue(num);
    	  try {
              Thread.sleep(100);
             }catch(InterruptedException e){}
             num +=10;
    	      }
     	}	
       public static void main(String args[]) {
              exiting e=new exiting();
    	   e.setVisible(true);
            try 
            {
              Thread.sleep(150);
             }catch(InterruptedException i){}
         	 System.exit(0);
            }
        private javax.swing.JLabel jLabel1;
        private javax.swing.JProgressBar jProgressBar1;
    	}

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. dispose() does not work here
    By arunkumarinfo in forum NetBeans
    Replies: 5
    Last Post: 12-28-2013, 05:42 PM
  2. dispose() method not working
    By R&R in forum New To Java
    Replies: 19
    Last Post: 11-15-2010, 01:46 AM
  3. Dispose a JDesktopPane for logout.
    By hendrix79 in forum New To Java
    Replies: 3
    Last Post: 02-10-2009, 03:09 PM
  4. [SOLVED] how do I dispose a view?
    By xcallmejudasx in forum New To Java
    Replies: 2
    Last Post: 11-07-2008, 06:15 PM
  5. How to dispose tooltip.
    By Preethi in forum New To Java
    Replies: 1
    Last Post: 07-22-2008, 07:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •